LeetCode

337. House Robber III

337. House Robber III 這一題是 198. House Robber 和 213.

606. Construct String from Binary Tree

606. Construct String from Binary Tree # Definition for a binary

209. Minimum Size Subarray Sum

209. Minimum Size Subarray Sum 題目有給目標值,要找尋的子陣列是子陣列總和大於或等於目標值即可。 所以滑動窗口的題目,我們只要找到子陣列的總和開始大於或等於目標的時候,就可以開始縮減窗口,

208. Implement Trie Prefix Tree

208. Implement Trie (Prefix Tree) class Trie: def __init__(self)

105. Construct Binary Tree from Preorder and Inorder Traversal

105. Construct Binary Tree from Preorder and Inorder Traversal 題目給出前序遍歷以及中序遍歷的順序,

3. Longest Substring Without Repeating Characters

3. Longest Substring Without Repeating Characters 這一題其實是可以透過暴力解法想辦法算出來的,那就是窮舉出所有的子字串,並且檢查每一個子字串有沒有重複的字元。時間複雜度約為

536. Construct Binary Tree from String

536. Construct Binary Tree from String 做這題之前可以先完成 606. Construct String

27. Remove Element

27. Remove Element 要從兩個方向看 1. 如果現在最右邊的指針,當下的值和 val 相同,想辦法往左邊移,

424. Longest Repeating Character Replacement

424. Longest Repeating Character Replacement class Solution: def characterReplacement(self,

11. Container With Most Water

11. Container With Most Water 解題的核心想法是有一句俗諺:水桶的最大容量決定於最矮的一邊。 題目給出的正是水桶高度,只是俗諺中的水桶,底部的面積都一樣,