129. Sum Root to Leaf Numbers

1.問題

  • 給予一個binary tree, 計算所有路徑的總和

2.想法

  • 提問

  • function header, parameter

  • test input

  • 觀察

    • DFS, 當到達盡頭時計算總和

    • 總和要用long

  • 說明想法

  • 測試計算複雜度

3.程式碼

Last updated