LeetCode

652. Find Duplicate Subtrees

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

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:

104. Maximum Depth of Binary Tree

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

111. Minimum Depth of Binary Tree

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

543. Diameter of Binary Tree

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

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

648. Replace Words

648. Replace Words 這一題就屬於一開始看題目比較不容易看出來要是用 Trie ,題目中的一個小提示是最後我們要輸出的字串,是要輸出的是每個單字的 prefix ,看到要找 prefix