理論基礎(chǔ) 動(dòng)態(tài)規(guī)劃五部曲 確定dp數(shù)組 遞推公式 dp數(shù)組如何初始化 確定遍歷順序 打印dp數(shù)組 509. 斐波那契數(shù) 本題比較簡(jiǎn)單,直接套用動(dòng)態(tài)規(guī)劃五部曲即可 70. 爬樓...
理論基礎(chǔ) 動(dòng)態(tài)規(guī)劃五部曲 確定dp數(shù)組 遞推公式 dp數(shù)組如何初始化 確定遍歷順序 打印dp數(shù)組 509. 斐波那契數(shù) 本題比較簡(jiǎn)單,直接套用動(dòng)態(tài)規(guī)劃五部曲即可 70. 爬樓...
738.單調(diào)遞增的數(shù)字 738. 單調(diào)遞增的數(shù)字 - 力扣(LeetCode)[https://leetcode.cn/problems/monotone-increasin...
435. 無重疊區(qū)間 435. 無重疊區(qū)間 - 力扣(LeetCode)[https://leetcode.cn/problems/non-overlapping-inter...
860.檸檬水找零 860. 檸檬水找零 - 力扣(LeetCode)[https://leetcode.cn/problems/lemonade-change/descri...
1005.K次取反后最大化的數(shù)組和 先將數(shù)組排序,依次將負(fù)數(shù)變?yōu)檎龜?shù),如果到了末尾,k還是大于0,那么需要判斷k的奇偶,如果是奇數(shù),那么將數(shù)組重新排序,開頭元素取反,如果是偶...
122.買賣股票的最佳時(shí)機(jī)II 122. 買賣股票的最佳時(shí)機(jī) II - 力扣(LeetCode)[https://leetcode.cn/problems/best-time...
理論基礎(chǔ) 貪心算法的本質(zhì)是由局部最優(yōu)推到全局最優(yōu),沒有特定的套路 455.分發(fā)餅干 455. 分發(fā)餅干 - 力扣(LeetCode)[https://leetcode.cn/...
491.遞增子序列 491. 非遞減子序列 - 力扣(LeetCode)[https://leetcode.cn/problems/non-decreasing-subseq...
93.復(fù)原IP地址 93. 復(fù)原 IP 地址 - 力扣(LeetCode)[https://leetcode.cn/problems/restore-ip-addresses...
39. 組合總和 39. 組合總和 - 力扣(LeetCode)[https://leetcode.cn/problems/combination-sum/]本題和之前組合題...
216.組合總和III 216. 組合總和 III - 力扣(LeetCode)[https://leetcode.cn/problems/combination-sum-i...
理論基礎(chǔ) 回溯是和遞歸相輔相成的,回溯的本質(zhì)就是暴力解法,用于那些多層for循環(huán)無法解決的問題,比如組合、切割、集合等,回溯也有三個(gè)步驟 確定回溯函數(shù)的參數(shù)與返回值,一般情況...
669. 修剪二叉搜索樹 669. 修剪二叉搜索樹 - 力扣(LeetCode)[https://leetcode.cn/problems/trim-a-binary-sea...
235. 二叉搜索樹的最近公共祖先 235. 二叉搜索樹的最近公共祖先 - 力扣(LeetCode)[https://leetcode.cn/problems/lowest-...
530.二叉搜索樹的最小絕對(duì)差 530. 二叉搜索樹的最小絕對(duì)差 - 力扣(LeetCode)[https://leetcode.cn/problems/minimum-ab...
654.最大二叉樹 654. 最大二叉樹 - 力扣(LeetCode)[https://leetcode.cn/problems/maximum-binary-tree/su...
513.找樹左下角的值 513. 找樹左下角的值 - 力扣(LeetCode)[https://leetcode.cn/problems/find-bottom-left-t...
平衡二叉樹 110. 平衡二叉樹 - 力扣(LeetCode)[https://leetcode.cn/problems/balanced-binary-tree/descr...
二叉樹的最大深度 104. 二叉樹的最大深度 - 力扣(LeetCode)[https://leetcode.cn/problems/maximum-depth-of-bin...
層序遍歷 見上個(gè)筆記 翻轉(zhuǎn)二叉樹 226. 翻轉(zhuǎn)二叉樹[https://leetcode.cn/problems/invert-binary-tree/submissions...