An open API service indexing awesome lists of open source software.

https://github.com/xiedacon/leetcode

leetcode算法题集
https://github.com/xiedacon/leetcode

algorithms leetcode

Last synced: 7 months ago
JSON representation

leetcode算法题集

Awesome Lists containing this project

README

          

# leetcode算法题集

1. [Two Sum](./algorithms/1.Two%20Sum.md)
2. [Add Two Numbers](./algorithms/2.Add%20Two%20Numbers.md)
3. [Longest Substring Without Repeating Characters](./algorithms/3.Longest%20Substring%20Without%20Repeating%20Characters.md)
4. Median of Two Sorted Arrays
5. [Longest Palindromic Substring](./algorithms/5.Longest%20Palindromic%20Substring.md)
6. [ZigZag Conversion](./algorithms/6.ZigZag%20Conversion.md)
7. [Reverse Integer](./algorithms/7.Reverse%20Integer.md)
8. [String to Integer (atoi)](./algorithms/8.String%20to%20Integer.md)
9. [Palindrome Number](./algorithms/9.Palindrome%20Number.md)
10. Regular Expression Matching
11. [Container With Most Water](./algorithms/11.Container%20With%20Most%20Water.md)
12. [Integer to Roman](./algorithms/12.Integer%20to%20Roman.md)
13. [Roman to Integer](./algorithms/13.Roman%20to%20Integer.md)
14. [Longest Common Prefix](./algorithms/14.Longest%20Common%20Prefix.md)
15. [3Sum](./algorithms/15.3Sum.md)
16. [3Sum Closest](./algorithms/16.3Sum%20Closest.md)
17. [Letter Combinations of a Phone Number](./algorithms/17.Letter%20Combinations%20of%20a%20Phone%20Number.md)
18. [4Sum](./algorithms/18.4Sum.md)
19. [Remove Nth Node From End of List](./algorithms/19.Remove%20Nth%20Node%20From%20End%20of%20List.md)
20. [Valid Parentheses](./algorithms/20.Valid%20Parentheses.md)
21. [Merge Two Sorted Lists](./algorithms/21.Merge%20Two%20Sorted%20Lists.md)
22. [Generate Parentheses](./algorithms/22.Generate%20Parentheses.md)
23. [Merge k Sorted Lists](./algorithms/23.Merge%20k%20Sorted%20Lists.md)
24. [Swap Nodes in Pairs](./algorithms/24.Swap%20Nodes%20in%20Pairs.md)
25. [Reverse Nodes in k-Group](./algorithms/25.Reverse%20Nodes%20in%20k-Group.md)
26. [Remove Duplicates from Sorted Array](./algorithms/26.Remove%20Duplicates%20from%20Sorted%20Array.md)
27. [Remove Element](./algorithms/27.Remove%20Element.md)
28. [Implement strStr()](./algorithms/28.Implement%20strStr.md)
29. [Divide Two Integers](./algorithms/29.Divide%20Two%20Integers.md)
30. Substring with Concatenation of All Words
31. [Next Permutation](./algorithms/31.Next%20Permutation.md)
32. [Longest Valid Parentheses](./algorithms/32.Longest%20Valid%20Parentheses.md)
33. [Search in Rotated Sorted Array](./algorithms/33.Search%20in%20Rotated%20Sorted%20Array.md)
34. [Search for a Range](./algorithms/34.Search%20for%20a%20Range.md)
35. [Search Insert Position](./algorithms/35.Search%20Insert%20Position.md)
36. [Valid Sudoku](./algorithms/36.Valid%20Sudoku.md)
37. [Sudoku Solver](./algorithms/37.Sudoku%20Solver.md)
38. Count and Say
39. [Combination Sum](./algorithms/39.Combination%20Sum.md)
40. [Combination Sum II](./algorithms/40.Combination%20Sum%20II.md)
41. [First Missing Positive](./algorithms/41.First%20Missing%20Positive.md)
42. [Trapping Rain Water](./algorithms/42.Trapping%20Rain%20Water.md)
43. [Multiply Strings](./algorithms/43.Multiply%20Strings.md)
44. Wildcard Matching
45. [Jump Game II](./algorithms/45.Jump%20Game%20II.md)
46. [Permutations](./algorithms/46.Permutations.md)
47. [Permutations II](./algorithms/47.Permutations%20II.md)
48. [Rotate Image](./algorithms/48.Rotate%20Image.md)
49. [Group Anagrams](./algorithms/49.Group%20Anagrams.md)
50. [Pow(x, n)](./algorithms/50.Pow%20x, n .md)
51. N-Queens
52. N-Queens II
53. [Maximum Subarray](./algorithms/53.Maximum%20Subarray.md)
54. [Spiral Matrix](./algorithms/54.Spiral%20Matrix.md)
55. [Jump Game](./algorithms/55.Jump%20Game.md)
56. [Merge Intervals](./algorithms/56.Merge%20Intervals.md)
57. [Insert Interval](./algorithms/57.Insert%20Interval.md)
58. [Length of Last Word](./algorithms/58.Length%20of%20Last%20Word.md)
59. [Spiral Matrix II](./algorithms/59.Spiral%20Matrix%20II.md)
60. [Permutation Sequence](./algorithms/60.Permutation%20Sequence.md)
61. [Rotate List](./algorithms/61.Rotate%20List.md)
62. [Unique Paths](./algorithms/62.Unique%20Paths.md)
63. [Unique Paths II](./algorithms/63.Unique%20Paths%20II.md)
64. [Minimum Path Sum](./algorithms/64.Minimum%20Path%20Sum.md)
65. Valid Number
66. [Plus One](./algorithms/66.Plus%20One.md)
67. [Add Binary](./algorithms/67.Add%20Binary.md)
68. [Text Justification](./algorithms/68.Text%20Justification.md)
69. [Sqrt(x)](./algorithms/69.Sqrt%20x .md)
70. [Climbing Stairs](./algorithms/70.Climbing%20Stairs.md)
71. [Simplify Path](./algorithms/71.Simplify%20Path.md)
72. [Edit Distance](./algorithms/72.Edit%20Distance.md)
73. [Set Matrix Zeroes](./algorithms/73.Set%20Matrix%20Zeroes.md)
74. [Search a 2D Matrix](./algorithms/74.Search%20a%202D%20Matrix.md)
75. [Sort Colors](./algorithms/75.Sort%20Colors.md)
76. [Minimum Window Substring](./algorithms/76.Minimum%20Window%20Substring.md)
77. [Combinations](./algorithms/77.Combinations.md)
78. [Subsets](./algorithms/78.Subsets.md)
79. [Word Search](./algorithms/79.Word%20Search.md)
80. [Remove Duplicates from Sorted Array II](./algorithms/80.Remove%20Duplicates%20from%20Sorted%20Array%20II.md)
81. [Search in Rotated Sorted Array II](./algorithms/81.Search%20in%20Rotated%20Sorted%20Array%20II.md)
82. [Remove Duplicates from Sorted List II](./algorithms/82.Remove%20Duplicates%20from%20Sorted%20List%20II.md)
83. [Remove Duplicates from Sorted List](./algorithms/83.Remove%20Duplicates%20from%20Sorted%20List.md)
84. [Largest Rectangle in Histogram](./algorithms/84.Largest%20Rectangle%20in%20Histogram.md)
85. [Maximal Rectangle](./algorithms/85.Maximal%20Rectangle.md)
86. [Partition List](./algorithms/86.Partition%20List.md)
87. [Scramble String](./algorithms/87.Scramble%20String.md)
88. [Merge Sorted Array](./algorithms/88.Merge%20Sorted%20Array.md)
89. [Gray Code](./algorithms/89.Gray%20Code.md)
90. [Subsets II](./algorithms/90.Subsets%20II.md)
91. [Decode Ways](./algorithms/91.Decode%20Ways.md)
92. [Reverse Linked List II](./algorithms/92.Reverse%20Linked%20List%20II.md)
93. [Restore IP Addresses](./algorithms/93.Restore%20IP%20Addresses.md)
94. [Binary Tree Inorder Traversal](./algorithms/94.Binary%20Tree%20Inorder%20Traversal.md)
95. [Unique Binary Search Trees II](./algorithms/95.Unique%20Binary%20Search%20Trees%20II.md)
96. [Unique Binary Search Trees](./algorithms/96.Unique%20Binary%20Search%20Trees.md)
97. [Interleaving String](./algorithms/97.Interleaving%20String.md)
98. [Validate Binary Search Tree](./algorithms/98.Validate%20Binary%20Search%20Tree.md)
99. [Recover Binary Search Tree](./algorithms/99.Recover%20Binary%20Search%20Tree.md)
100. [Same Tree](./algorithms/100.Same%20Tree.md)
101. [Symmetric Tree](./algorithms/101.Symmetric%20Tree.md)
102. [Binary Tree Level Order Traversal](./algorithms/102.Binary%20Tree%20Level%20Order%20Traversal.md)
103. [Binary Tree Zigzag Level Order Traversal](./algorithms/103.Binary%20Tree%20Zigzag%20Level%20Order%20Traversal.md)
104. [Maximum Depth of Binary Tree](./algorithms/104.Maximum%20Depth%20of%20Binary%20Tree.md)
105. [Construct Binary Tree from Preorder and Inorder Traversal](./algorithms/105.Construct%20Binary%20Tree%20from%20Preorder%20and%20Inorder%20Traversal.md)
106. Construct Binary Tree from Inorder and Postorder Traversal
107. [Binary Tree Level Order Traversal II](./algorithms/107.Binary%20Tree%20Level%20Order%20Traversal%20II.md)
108. [Convert Sorted Array to Binary Search Tree](./algorithms/108.Convert%20Sorted%20Array%20to%20Binary%20Search%20Tree.md)
109. [Convert Sorted List to Binary Search Tree](./algorithms/109.Convert%20Sorted%20List%20to%20Binary%20Search%20Tree.md)
110. [Balanced Binary Tree](./algorithms/110.Balanced%20Binary%20Tree.md)
111. [Minimum Depth of Binary Tree](./algorithms/111.Minimum%20Depth%20of%20Binary%20Tree.md)
112. [Path Sum](./algorithms/112.Path%20Sum.md)
113. [Path Sum II](./algorithms/113.Path%20Sum%20II.md)
114. [Flatten Binary Tree to Linked List](./algorithms/114.Flatten%20Binary%20Tree%20to%20Linked%20List.md)
115. [Distinct Subsequences](./algorithms/115.Distinct%20Subsequences.md)
116. [Populating Next Right Pointers in Each Node](./algorithms/116.Populating%20Next%20Right%20Pointers%20in%20Each%20Node.md)
117. [Populating Next Right Pointers in Each Node II](./algorithms/117.Populating%20Next%20Right%20Pointers%20in%20Each%20Node%20II.md)
118. [Pascal's Triangle](./algorithms/118.Pascal's%20Triangle.md)
119. [Pascal's Triangle II](./algorithms/119.Pascal's%20Triangle%20II.md)

**目录生成脚本:**

```javascript
(function a(begin,end){
var tbody = document.querySelector("tbody"),temp = "";
if(begin && end)
while(begin<=end){
var name = tbody.children[begin-1].children[2].getAttribute("value");
temp += begin + ". [" + name + "](./algorithms/" + begin + "." + name.replace(/\s/g,"%20") + ".md)\r\n";
begin++;
}
console.log(temp);
})(1,200)
```

**页面转markdown脚本:**

> 不是100%正确,转换后需要修正

```javascript
(function(){
var temp = "# " + document.querySelector("h3").textContent.trim() + "\r\n";
function a(ele){
((ele instanceof Text) && (temp+=(ele.data.trim().length==0)?"\r\n":ele.data))
|| ((ele.matches("code")) && (temp+="``"+ele.textContent+"``"))
|| ((ele.matches("pre")) && (temp+="\r\n```\r\n"+ele.textContent+"```\r\n"))
|| ((ele.matches("b")) && (temp+="**"+ele.textContent+"**"))
|| ((ele.matches("img")) && (temp+="\r\n!(图片名)["+ele.src+"]\r\n"))
|| ((ele.matches("li")) && (temp+="* "+ele.textContent))
|| ele.matches("div")
|| Array.from(ele.childNodes).forEach((e) => {a(e);});
}
Array.from(document.querySelector("div.question-content").childNodes).forEach((e)=>{a(e);});
temp += "**Solution:**\r\n\r\n```java\r\n\r\n```"
console.log(temp);
})()
```