Tree

298. Binary Tree Longest Consecutive Sequence

298. Binary Tree Longest Consecutive Sequence 參考:257. Binary Tree

129. Sum Root to Leaf Numbers

129. Sum Root to Leaf Numbers 請參考 257. Binary Tree

257. Binary Tree Paths

257. Binary Tree Paths 題目給定一個二元樹,要找出從跟節點到最終的葉節點的所有路徑。 既然這個題目要求要找出所有可能的路徑,那就一定是需要窮舉的題目,既然需要窮舉,就可以用

199. Binary Tree Right Side View

199. Binary Tree Right Side View 這一題和 116. Populating Next

872. Leaf-Similar Trees

872. Leaf-Similar Trees # Definition for a binary tree node. # class

1466. Reorder Routes to Make All Paths Lead to the City Zero

1466. Reorder Routes to Make All Paths Lead to the

1091. Shortest Path in Binary Matrix

1091. Shortest Path in Binary Matrix 可以先練習這些題目 * 200. Number of

449. Serialize and Deserialize BST

449. Serialize and Deserialize BST 參考 297. Serialize and Deserialize

1490. Clone N-ary Tree

1490. Clone N-ary Tree 這個題目是樹,題目要考察是否可以寫出遍歷整棵樹的程式碼,類似的題目是 133. Clone Graph

124. Binary Tree Maximum Path Sum

124. Binary Tree Maximum Path Sum 這一題是後序遍歷的經典題目,後序遍歷的精神就是先將子樹的問題全部解決,再開始處理跟節點的問題,這一題要怎麼想到的確是屬於困難的題型。