Leetcode已刷題目題解彙總

xunalove發表於2018-02-16


Leetcode已刷題目題解連結彙總(持續更新中。。。。。。。)

分類 題解連結

【Easy-Brainteaser】
腦筋急轉彎
1道
292. Nim Game(尼姆遊戲)

【Easy-Sort 】
排序
3道

242. Valid Anagram(有顛倒順序構成的字串—字串排序(c++和python)
349. Intersection of Two Arrays(兩陣列的交集,vector中find()函式, 結果集去重)
350. Intersection of Two Arrays II(兩陣列交集)


【Easy-Greedy】
貪心
2道
122. Best Time to Buy and Sell Stock II(股票多次買賣的最佳時間–貪心)
455. Assign Cookies(分蛋糕–貪心)


【Easy-Stack】

6道

20. Valid Parentheses(有效括號-棧)
155. Min Stack(帶有獲取當前最小值的棧)
225. Implement Stack using Queues(用佇列模擬棧)
232.Implement Queue using Stacks
496.Next Greater Element I
682.Baseball Game



【Easy-Queue】
佇列
6道

20. Valid Parentheses(有效括號-棧)
155. Min Stack(帶有獲取當前最小值的棧)
225. Implement Stack using Queues(用佇列模擬棧)
232.Implement Queue using Stacks
496.Next Greater Element I
682.Baseball Game


【Easy-Dynamic Programming】
動態規劃
6道

53. Maximum Subarray(連續子序列的最大和)
70. Climbing Stairs(爬樓梯
121. Best Time to Buy and Sell Stock(股票一次買賣的最佳時期—動態規劃)
198. House Robber(動態規劃–房屋強盜) 303. Range Sum Query - Immutable(和累加法) 746. Min Cost Climbing Stairs(最低花費登樓梯–動態規劃)

















【Easy-Array】
陣列
50道

1. Two Sum(雜湊)
26. Remove Duplicates from Sorted Array
27. Remove Element
35. Search Insert Position
53. Maximum Subarray(連續子序列的最大和)
66. Plus One &&Add Binary (大數)
88. Merge Sorted Array
118. Pascal’s Triangle(楊輝三角I)
119. Pascal’s Triangle II(楊輝三角II)
121. Best Time to Buy and Sell Stock(股票一次買賣的最佳時期—動態規劃)
122. Best Time to Buy and Sell Stock II(股票多次買賣的最佳時間–貪心)
167. Two Sum II - Input array is sorted(雙向查詢)
169. Majority Element(四種解法)
189. Rotate Array(翻轉陣列)
217. Contains Duplicate(包含副本)
219. Contains Duplicate II(包含副本II)
268. Missing Number(異或)
283. Move Zeroes
414. Third Maximum Number
448. Find All Numbers Disappeared in an Array
485. Max Consecutive Ones
532. K-diff Pairs in an Array(k差異對
561. Array Partition I
566. Reshape the Matrix(重塑矩陣)
581. Shortest Unsorted Continuous Subarray(最短未排連續子陣列)
605. Can Place Flowers
628.aximum Product of Three Numbers(三個數最大積)
643. Maximum Average Subarray I(連續子陣列的最大平均值
661. Image Smoother
665. Non-decreasing Array(非遞減陣列)
674. Longest Continuous Increasing Subsequence(最長連續遞增子序列的長度))
695. Max Area of Island(島嶼最大面積,深搜dfs)
697. Degree of an Array(陣列的度)
717. 1-bit and 2-bit Characters
724. Find Pivot Index
746. Min Cost Climbing Stairs(最低花費登樓梯–動態規劃)
747. Largest Number At Least Twice of Others
766. Toeplitz Matrix (託普利茲矩陣)

2. Add Two Numbers(連結串列模擬大數演算法)
3. Longest Substring Without Repeating Characters(最長不重複子串-雜湊))
4.Median of Two Sorted Arrays(歸併排序&二分查詢求第k小的數)
5. Longest Palindromic Substring(最長迴文子串:二種解法)
7. Reverse Integer(位運算)
8. String to Integer (atoi)(字串轉數字)
9. Palindrome Number(迴文數)
12. Roman to Integer (阿拉伯數字轉化羅馬數字)
13. Roman to Integer (羅馬數字轉化阿拉伯數字)
14. Longest Common Prefix (最長公共字首字串)

21. Merge Two Sorted Lists (歸併排序之單連結串列)

28. Implement strStr()(String find()函式的用法)

38. Count and Say (模擬)

58. Length of Last Word

100. Same Tree(判斷兩個二叉樹相同)
101. Symmetric Tree(對稱樹)
104. Maximum Depth of Binary Tree(最大二叉樹的深度)
107. Binary Tree Level Order Traversal II (queue二叉樹層次遍歷)
108. Convert Sorted Array to Binary Search Tree (平衡二叉查詢樹)
110. Balanced Binary Tree(判斷是否是平衡二叉樹)
111. Minimum Depth of Binary Tree(二叉樹的最小深度

125. Valid Palindrome(合法的迴文串)
136. Single Number(出現一次的數&異或)

168. Excel Sheet Column Title(Excel表列名–進位制轉換)

171. Excel Sheet Column Number(Excel表列號–進位制轉換)
176. Second Highest Salary(第二高薪水 - SQL語句)

190. Reverse Bits (反向位&位運算)
191. Number of 1 Bits(位運算)

231. Power of Two(2次冪)
257. Binary Tree Paths(二叉樹的所有路徑)
258. Add Digits (數字根)

326. Power of Three(3次冪)
342. Power of Four(4次冪)
344. Reverse String
371. Sum of Two Integers (位運算實現加法)
389. Find the Difference(位運算=異或)
412. Fizz Buzz

415. Add Strings (大數加法超簡單寫法)
415. Add Strings (大數加法超簡單寫法)

461Hamming Distance(異或)
476. Number Complement(求補碼)

相關文章