Backtrack

93. Restore IP Addresses

93. Restore IP Addresses 參考 131. Palindrome Partitioning class Solution:

131. Palindrome Partitioning

131. Palindrome Partitioning class Solution: def partition(self, s: str)

301. Remove Invalid Parentheses

301. Remove Invalid Parentheses from typing import List class Solution:

967. Numbers With Same Consecutive Differences

967. Numbers With Same Consecutive Differences class Solution: def numsSameConsecDiff(

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 題目給定一個二元樹,要找出從跟節點到最終的葉節點的所有路徑。 既然這個題目要求要找出所有可能的路徑,那就一定是需要窮舉的題目,既然需要窮舉,就可以用

797. All Paths From Source to Target

797. All Paths From Source to Target class Solution: def

139. Word Break

139. Word Break 這個題目的要求是給定一個字串與一個陣列,陣列裡面裡面有多個單字,目標是要回答,是否可以透過任意組合陣列裡面的單字,且陣列裡面的每個單字都是可以重複使用,可以拼湊出題目給的字串。 題目的要求很清楚,

140. Word Break II

140. Word Break II 💡請先參考 139. Word Break 在 139.