LeetCode

114. Flatten Binary Tree to Linked List

114. Flatten Binary Tree to Linked List 這一是後續遍歷很經典的一道題目,體現了後續遍歷很重要的一個精神,當後續遍歷到一半,

652. Find Duplicate Subtrees

652. Find Duplicate Subtrees 建議先做過 536. Construct Binary Tree from

543. Diameter of Binary Tree

543. Diameter of Binary Tree 這一題和 124. Binary Tree Maximum

429. N-ary Tree Level Order Traversal

429. N-ary Tree Level Order Traversal 可以先做這題 116. Populating Next

417. Pacific Atlantic Water Flow

417. Pacific Atlantic Water Flow 廣度優先搜索 BFS 也可以利用一次把多個點加入 queue 後再開始出發,

752. Open the Lock

752. Open the Lock class Solution: def openLock(self, deadends:

111. Minimum Depth of Binary Tree

111. Minimum Depth of Binary Tree # Definition for a binary

104. Maximum Depth of Binary Tree

104. Maximum Depth of Binary Tree # Definition for a binary

572. Subtree of Another Tree

# Definition for a binary tree node. # class TreeNode: # def __init_

428. Serialize and Deserialize N-ary Tree

428. Serialize and Deserialize N-ary Tree