101. Symmetric Tree

1.問題

  • 給予一個binary tree, 判斷是否為對稱

2.想法

  • 提問

    • 確認題意: root是NULL是true或false?

  • function header, parameter

  • test input

  • 說明想法

    • 將root複製出一份左右對稱的樹後, 比較root 與該數是否是same tree

  • 測試計算複雜度

    • recursive的runtime是計算total call number

      • deepCopy

      • swap

      • isSameTree

3.程式碼

Last updated