491. 遞增子序列[https://leetcode.cn/problems/non-decreasing-subsequences/] 給你一個(gè)整數(shù)數(shù)組 nums ,找出...
491. 遞增子序列[https://leetcode.cn/problems/non-decreasing-subsequences/] 給你一個(gè)整數(shù)數(shù)組 nums ,找出...
93.復(fù)原IP地址 先跳過(guò) 78.子集 給你一個(gè)整數(shù)數(shù)組 nums ,數(shù)組中的元素 互不相同 。返回該數(shù)組所有可能的子集(冪集)。 解集 不能 包含重復(fù)的子集。你可以按 任意...
39. 組合總和[https://leetcode.cn/problems/combination-sum/] 給你一個(gè) 無(wú)重復(fù)元素 的整數(shù)數(shù)組 candidates 和一個(gè)...
216. 組合總和 III[https://leetcode.cn/problems/combination-sum-iii/] 找出所有相加之和為 n 的 k 個(gè)數(shù)的組合,...
需要總結(jié)一下回溯的場(chǎng)景、套路、剪枝操作 77. 組合[https://leetcode.cn/problems/combinations/] 給定兩個(gè)整數(shù) n 和 k,返回范...
669. 修剪二叉搜索樹(shù) 難。沒(méi)來(lái)得及弄。周六做 108. 將有序數(shù)組轉(zhuǎn)換為二叉搜索樹(shù)[https://leetcode.cn/problems/convert-sorted...
235. 二叉搜索樹(shù)的最近公共祖先 給定一個(gè)二叉搜索樹(shù), 找到該樹(shù)中兩個(gè)指定節(jié)點(diǎn)的最近公共祖先。 百度百科中最近公共祖先的定義為:“對(duì)于有根樹(shù) T 的兩個(gè)結(jié)點(diǎn) p、q,最近公...
530. 二叉搜索樹(shù)的最小絕對(duì)差[https://leetcode.cn/problems/minimum-absolute-difference-in-bst/] 給你一個(gè)...
617. 合并二叉樹(shù)[https://leetcode.cn/problems/merge-two-binary-trees/] 你兩棵二叉樹(shù): root1 和 root2 ...
513. 找樹(shù)左下角的值[https://leetcode.cn/problems/find-bottom-left-tree-value/] 給定一個(gè)二叉樹(shù)的 根節(jié)點(diǎn) ro...
110. 平衡二叉樹(shù)[https://leetcode.cn/problems/balanced-binary-tree/] 給定一個(gè)二叉樹(shù),判斷它是否是高度平衡的二叉樹(shù)。本...
注意點(diǎn):貌似所有的二叉樹(shù)題目,都可以通過(guò)層次遍歷解決 104. 二叉樹(shù)的最大深度[https://leetcode.cn/problems/maximum-depth-of-...
102. 二叉樹(shù)的層序遍歷[https://leetcode.cn/problems/binary-tree-level-order-traversal/] 給你二叉樹(shù)的根節(jié)...
144.二叉樹(shù)的前序遍歷(opens new window)[https://leetcode.cn/problems/binary-tree-preorder-traver...
347. 前 K 個(gè)高頻元素[https://leetcode.cn/problems/top-k-frequent-elements/] 給你一個(gè)整數(shù)數(shù)組 nums 和一個(gè)...
20. 有效的括號(hào) 1047. 刪除字符串中的所有相鄰重復(fù)項(xiàng)[https://leetcode.cn/problems/remove-all-adjacent-duplica...
232. 用棧實(shí)現(xiàn)隊(duì)列[https://leetcode.cn/problems/implement-queue-using-stacks/] 關(guān)鍵點(diǎn): 1.兩個(gè)棧inSta...
344. 反轉(zhuǎn)字符串[https://leetcode.cn/problems/reverse-string/] 編寫(xiě)一個(gè)函數(shù),其作用是將輸入的字符串反轉(zhuǎn)過(guò)來(lái)。輸入字符串以字...
454.四數(shù)相加II 力扣題目鏈接(opens new window)[https://leetcode.cn/problems/4sum-ii/]給定四個(gè)包含整數(shù)的數(shù)組列表...
注意點(diǎn) 注意unordered_map\map\multimap 底層實(shí)現(xiàn)的算法結(jié)構(gòu)(哈希表還是紅黑樹(shù)),適用的場(chǎng)景的算法復(fù)雜度 ● 242.有效的字母異位詞 給定兩個(gè)字符串...