开启LeetCode之路
終于有時間開始每天堅持做LeetCode題,博主現在以在CSDN上撰寫解題思路為自我監督方式,堅持每天將當天的題目的解題思路記錄下來。
LeetCode刷題路線:博主將計劃按tag順序做題,先以簡單和中等難度為主。
編程語言:博主選擇用C++來解題并記錄。
共勉~
?
第一部分:棧
2019-05-09:
Leetcode 232. 用棧實現隊列 :?https://blog.csdn.net/gjh13/article/details/90034055? 難度:簡單
LeetCode 496. 下一個更大元素 I :https://blog.csdn.net/gjh13/article/details/90047695?難度:簡單
Leetcode 682. 棒球比賽:https://blog.csdn.net/gjh13/article/details/90048331?難度:簡單
?
2019-05-10
Leetcode 844. 比較含退格的字符串:https://blog.csdn.net/gjh13/article/details/90085181?難度:簡單
Leetcode 94. 二叉樹的中序遍歷:https://blog.csdn.net/gjh13/article/details/90085551?難度:中等
?
2019-05-13
Leetcode 103. 二叉樹的鋸齒形層次遍歷:https://blog.csdn.net/gjh13/article/details/90182542?難度:中等
Leetcode 144. 二叉樹的前序遍歷:https://blog.csdn.net/gjh13/article/details/90183335?難度:中等
?
2019-05-14
Leetcode 150. 逆波蘭表達式求值:https://blog.csdn.net/gjh13/article/details/90212020?難度:中等
Leetcode 173. 二叉搜索樹迭代器:https://blog.csdn.net/gjh13/article/details/90213612?難度:中等
?
第二部分:堆
2019-05-15
Leetcode 703. 數據流中的第K大元素:https://blog.csdn.net/gjh13/article/details/90246978?難度:簡單
Leetcode 215. 數組中的第K個最大元素:https://blog.csdn.net/gjh13/article/details/90247102?難度:中等
?
2019-05-16
Leetcode 264. 丑數 II:https://blog.csdn.net/gjh13/article/details/90247437?難度:中等
Leetcode 313. 超級丑數:https://blog.csdn.net/gjh13/article/details/90258606?難度:中等
Leetcode 347. 前K個高頻元素:https://blog.csdn.net/gjh13/article/details/90262399?難度:中等
Leetcode 373. 查找和最小的K對數字:https://blog.csdn.net/gjh13/article/details/90273634?難度:中等
?
2019-05-17
Leetcode 378. 有序矩陣中第K小的元素:https://blog.csdn.net/gjh13/article/details/90300904?難度:中等
Leetcode 451. 根據字符出現頻率排序:https://blog.csdn.net/gjh13/article/details/90301243?難度:中等
?
第三部分:貪心算法
貪心算法的學習可看看這個博客:https://www.cnblogs.com/steven_oyj/archive/2010/05/22/1741375.html
2019-05-18
Leetcode 122. 買賣股票的最佳時機 II :https://blog.csdn.net/gjh13/article/details/90313752?難度:簡單
Leetcode 455. 分發餅干:https://blog.csdn.net/gjh13/article/details/90313874?難度:簡單
Leetcode 860. 檸檬水找零:https://blog.csdn.net/gjh13/article/details/90314185?難度:簡單
Leetcode 134. 加油站:https://blog.csdn.net/gjh13/article/details/90314626?難度:中等
?
2019-05-19
Leetcode 376. 擺動序列:https://blog.csdn.net/gjh13/article/details/90341549?難度:中等
Leetcode 392. 判斷子序列:https://blog.csdn.net/gjh13/article/details/90341922?難度:中等
?
第四部分:排序
2019-05-19
Leetcode 242. 有效的字母異位詞:https://blog.csdn.net/gjh13/article/details/90342031?難度:簡單
Leetcode 349. 兩個數組的交集:https://blog.csdn.net/gjh13/article/details/90342471:難度:簡單
Leetcode 350. 兩個數組的交集 II:https://blog.csdn.net/gjh13/article/details/90342609?難度:簡單
?
2019-05-23
Leetcode 147. 對鏈表進行插入排序:https://blog.csdn.net/gjh13/article/details/90480218?難度:中等
?
2019-05-25
Leetcode 148. 排序鏈表:https://blog.csdn.net/gjh13/article/details/90545932?難度:中等
Leetcode 179. 最大數:https://blog.csdn.net/gjh13/article/details/90547131?難度:中等
Leetcode 220. 存在重復元素 III:https://blog.csdn.net/gjh13/article/details/90550167?難度:中等
?
第五部分:位運算
2019-05-25
Leetcode 136. 只出現一次的數字:https://blog.csdn.net/gjh13/article/details/90550405?難度:簡單
Leetcode 169. 求眾數:https://blog.csdn.net/gjh13/article/details/90550660?難度:簡單
?
2019-06-01
Leetcode 190. 顛倒二進制位:https://blog.csdn.net/gjh13/article/details/90727877?難度:簡單
Leetcode 191. 位1的個數:https://blog.csdn.net/gjh13/article/details/90728069?難度:簡單
Leetcode 231. 2的冪 :https://blog.csdn.net/gjh13/article/details/90728209?難度:簡單
Leetcode 268. 缺失數字 :https://blog.csdn.net/gjh13/article/details/90728515?難度:簡單
Leetcode 137. 只出現一次的數字 II :https://blog.csdn.net/gjh13/article/details/90728971?難度:中等
Leetcode 187. 重復的DNA序列 :https://blog.csdn.net/gjh13/article/details/90733161?難度:中等
Leetcode 201. 數字范圍按位與 :https://blog.csdn.net/gjh13/article/details/90733575?難度:中等
Leetcode 260. 只出現一次的數字 III:https://blog.csdn.net/gjh13/article/details/90734039?難度:中等
?
第六部分:樹
2019-06-02
Leetcode 100. 相同的樹:https://blog.csdn.net/gjh13/article/details/90737664?難度:簡單
Leetcode 101. 對稱二叉樹:https://blog.csdn.net/gjh13/article/details/90737952?難度:簡單
Leetcode 104. 二叉樹的最大深度:https://blog.csdn.net/gjh13/article/details/90738048?難度:簡單
Leetcode 107. 二叉樹的層次遍歷 II:https://blog.csdn.net/gjh13/article/details/90740002?難度:簡單
Leetcode 257. 二叉樹的所有路徑:https://blog.csdn.net/gjh13/article/details/90742767?難度:簡單
?
2019-06-13
Leetcode 95. 不同的二叉搜索樹 II:https://blog.csdn.net/gjh13/article/details/91902718?難度:中等
?
2019-06-15
Leetcode 96. 不同的二叉搜索樹:https://blog.csdn.net/gjh13/article/details/92103301?難度:中等
Leetcode 98. 驗證二叉搜索樹:https://blog.csdn.net/gjh13/article/details/92109267?難度:中等
Leetcode 102. 二叉樹的層次遍歷:https://blog.csdn.net/gjh13/article/details/92142549?難度:中等
Leetcode 105. 從前序與中序遍歷序列構造二叉樹:https://blog.csdn.net/gjh13/article/details/92164684?難度:中等
Leetcode 106. 從中序與后序遍歷序列構造二叉樹:https://blog.csdn.net/gjh13/article/details/92178372?難度:中等
Leetcode 113. 路徑總和 II:https://blog.csdn.net/gjh13/article/details/92211700?難度:中等
?
2019-06-23
Leetcode 114. 二叉樹展開為鏈表:https://blog.csdn.net/gjh13/article/details/93405065?難度:中等
Leetcode 116. 填充每個節點的下一個右側節點指針:https://blog.csdn.net/gjh13/article/details/93407916?難度:中等
Leetcode 117. 填充每個節點的下一個右側節點指針 II:https://blog.csdn.net/gjh13/article/details/93410685?難度:中等
Leetcode 129. 求根到葉子節點數字之和:https://blog.csdn.net/gjh13/article/details/93413515?難度:中等
?
2019-06-24
Leetcode 199. 二叉樹的右視圖:https://blog.csdn.net/gjh13/article/details/93536830?難度:中等
?
第七部分:深度優先搜索
2019-07-09
Leetcode 109. 有序鏈表轉換二叉搜索樹:https://blog.csdn.net/gjh13/article/details/95217506?難度:中等
?
2019-07-10
Leetcode 130. 被圍繞的區域:https://blog.csdn.net/gjh13/article/details/95315955?難度:中等
Leetcode 133. 克隆圖:https://blog.csdn.net/gjh13/article/details/95331596?難度:中等
Leetcode 200. 島嶼數量:https://blog.csdn.net/gjh13/article/details/95334898?難度:中等
Leetcode 207. 課程表:https://blog.csdn.net/gjh13/article/details/95343384?難度:中等
Leetcode 210. 課程表 II:https://blog.csdn.net/gjh13/article/details/95392164?難度:中等
?
第八部分:廣度優先搜索
2019-07-16
Leetcode 127. 單詞接龍:https://blog.csdn.net/gjh13/article/details/96157719?難度:中等
?
第九部分:設計
2019-07-20
Leetcode 146. LRU緩存機制:https://blog.csdn.net/gjh13/article/details/96589770?難度:中等
?
第十部分:Trie樹
2019-07-20
Leetcode 208. 實現 Trie (前綴樹):https://blog.csdn.net/gjh13/article/details/96603832?難度:中等
?
2019-07-21
Leetcode 211. 添加與搜索單詞 - 數據結構設計:https://blog.csdn.net/gjh13/article/details/96707733?難度:中等
?
第十一部分:遞歸
2019-07-21
Leetcode 698. 劃分為k個相等的子集:https://blog.csdn.net/gjh13/article/details/96725648?難度:中等
?
第十二部分:腦筋急轉彎
2019-07-21
Leetcode 292. Nim 游戲:https://blog.csdn.net/gjh13/article/details/96728691?難度:簡單
Leetcode 319. 燈泡開關:https://blog.csdn.net/gjh13/article/details/96735882?難度:中等
?
第十三部分:隊列
2019-07-25
Leetcode 621. 任務調度器:https://blog.csdn.net/gjh13/article/details/97243569?難度:中等
Leetcode 622. 設計循環隊列:https://blog.csdn.net/gjh13/article/details/97250026?難度:中等
?
第十四部分:極小化極大
2019-07-26
Leetcode 375. 猜數字大小 II:https://blog.csdn.net/gjh13/article/details/97373834?難度:中等
?
第十五部分:蓄水池抽樣
2019-07-26
Leetcode 382. 鏈表隨機節點:https://blog.csdn.net/gjh13/article/details/97375156?難度:中等
Leetcode 398. 隨機數索引:https://blog.csdn.net/gjh13/article/details/97375689?難度:中等
?
第十六部分:幾何
2019-07-26
Leetcode 963. 最小面積矩形 II :https://blog.csdn.net/gjh13/article/details/97392831?難度:中等
?
第十七部分:數組
2019-07-26
Leetcode 88. 合并兩個有序數組:https://blog.csdn.net/gjh13/article/details/97395076?難度:簡單
Leetcode 167. 兩數之和 II - 輸入有序數組:https://blog.csdn.net/gjh13/article/details/97395942?難度:簡單
Leetcode 189. 旋轉數組:https://blog.csdn.net/gjh13/article/details/97397650?難度:簡單
?
2019-07-27
Leetcode 217. 存在重復元素:https://blog.csdn.net/gjh13/article/details/97565931?難度:簡單
Leetcode 219. 存在重復元素 II:https://blog.csdn.net/gjh13/article/details/97567988?難度:簡單
Leetcode 283. 移動零:https://blog.csdn.net/gjh13/article/details/97571971?難度:簡單
?
2019-07-30
Leetcode 90. 子集 II:https://blog.csdn.net/gjh13/article/details/97759146?難度:中等
Leetcode 120. 三角形最小路徑和:https://blog.csdn.net/gjh13/article/details/97763782?難度:中等
Leetcode 152. 乘積最大子序列:https://blog.csdn.net/gjh13/article/details/97790522?難度:中等
Leetcode 153. 尋找旋轉排序數組中的最小值:https://blog.csdn.net/gjh13/article/details/97793603?難度:中等
Leetcode 162. 尋找峰值:https://blog.csdn.net/gjh13/article/details/97795082?難度:中等
Leetcode 209. 長度最小的子數組:https://blog.csdn.net/gjh13/article/details/97807712?難度:中等
?
第十八部分:哈希表
2019-08-03
Leetcode 202. 快樂數:https://blog.csdn.net/gjh13/article/details/98316709?難度:簡單
Leetcode 204. 計數質數:https://blog.csdn.net/gjh13/article/details/98329825?難度:簡單
Leetcode 205. 同構字符串:https://blog.csdn.net/gjh13/article/details/98335418?難度:簡單
?
2019-08-14
Leetcode 138. 復制帶隨機指針的鏈表:https://blog.csdn.net/gjh13/article/details/99546237?難度:中等
Leetcode 166. 分數到小數:https://blog.csdn.net/gjh13/article/details/99565153?難度:中等
?
第十九部分:鏈表
2019-08-14
Leetcode 141. 環形鏈表:https://blog.csdn.net/gjh13/article/details/99567282?難度:簡單
Leetcode 160. 相交鏈表:https://blog.csdn.net/gjh13/article/details/99572361?難度:簡單
Leetcode 203. 移除鏈表元素:https://blog.csdn.net/gjh13/article/details/99573869?難度:簡單
Leetcode 206. 反轉鏈表:https://blog.csdn.net/gjh13/article/details/99578190?難度:簡單
?
?
第二十部分:數學
2019-08-15
Leetcode 168. Excel表列名稱:https://blog.csdn.net/gjh13/article/details/99648312?難度:簡單
Leetcode 171. Excel表列序號:https://blog.csdn.net/gjh13/article/details/99649113?難度:簡單
Leetcode 172. 階乘后的零:https://blog.csdn.net/gjh13/article/details/99663086?難度:簡單
?
2019-08-20
Leetcode 223. 矩形面積:https://blog.csdn.net/gjh13/article/details/99845686?難度:中等
Leetcode 279. 完全平方數:https://blog.csdn.net/gjh13/article/details/99850668?難度:中等
?
第二十一部分:雙指針
2019-08-20
Leetcode 125. 驗證回文串:https://blog.csdn.net/gjh13/article/details/99999440?難度:簡單
?
2019-08-24
Leetcode 234. 回文鏈表:https://blog.csdn.net/gjh13/article/details/100058585?難度:簡單
?
第二十二部分:字符串
2019-09-03
Leetcode 344. 反轉字符串:https://blog.csdn.net/gjh13/article/details/100528334?難度:簡單
Leetcode 345. 反轉字符串中的元音字母:https://blog.csdn.net/gjh13/article/details/100528591?難度:簡單
?
?
第二十三部分:二分查找
?
第二十四部分:分治算法
?
第二十五部分:動態規劃
?
第二十六部分:回溯算法
?
?
?
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的开启LeetCode之路的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Leetcode 232. 用栈实现队列
- 下一篇: LeetCode 496. 下一个更大元