LeetCode 个人分类

2018-05-17

数组

11. Container With Most Water 15. 3Sum 16. 3Sum Closest 26. Remove Duplicates from Sorted Array 27. Remove Element 31. Next Permutation 42. Trapping Rain Water 48. Rotate Image 54. Spiral Matrix 59. Spiral Matrix II 60. Permutation Sequence 73. Set Matrix Zeroes 75. Sort Colors 80. Remove Duplicates from Sorted Array II 88. Merge Sorted Array 118. Pascal’s Triangle 119. Pascal’s Triangle II

链表

2. Add Two Numbers 19. Remove Nth Node From End of List 21. Merge Two Sorted Lists 24. Swap Nodes in Pairs 25. Reverse Nodes in k-Group 61. Rotate List 82. Remove Duplicates from Sorted List II 83. Remove Duplicates from Sorted List 86. Partition List 92. Reverse Linked List II 138. Copy List with Random Pointer 141. Linked List Cycle 142. Linked List Cycle II 143. Reorder List

20. Valid Parentheses 32. Longest Valid Parentheses 71. Simplify Path 84. Largest Rectangle in Histogram 85. Maximal Rectangle 150. Evaluate Reverse Polish Notation 155. Min Stack

队列


字符串

6. ZigZag Conversion 8. String to Integer (atoi) 14. Longest Common Prefix 28. Implement strStr() 38. Count and Say 58. Length of Last Word 65. Valid Number 67. Add Binary 68. Text Justification 125. Valid Palindrome 151. Reverse Words in a String

94. Binary Tree Inorder Traversal 95. Unique Binary Search Trees II 96. Unique Binary Search Trees 98. Validate Binary Search Tree 99. Recover Binary Search Tree 100. Same Tree 101. Symmetric Tree 102. Binary Tree Level Order Traversal 103. Binary Tree Zigzag Level Order Traversal 104. Maximum Depth of Binary Tree 105. Construct Binary Tree from Preorder and Inorder Traversal 106. Construct Binary Tree from Inorder and Postorder Traversal 107. Binary Tree Level Order Traversal II 108. Convert Sorted Array to Binary Search Tree 109. Convert Sorted List to Binary Search Tree 110. Balanced Binary Tree 111. Minimum Depth of Binary Tree 112. Path Sum 113. Path Sum II 114. Flatten Binary Tree to Linked List 116. Populating Next Right Pointers in Each Node 117. Populating Next Right Pointers in Each Node II 124. Binary Tree Maximum Path Sum 129. Sum Root to Leaf Numbers 144. Binary Tree Preorder Traversal 145. Binary Tree Postorder Traversal

133. Clone Graph

二分搜索

4. Median of Two Sorted Arrays 33. Search in Rotated Sorted Array 34. Find First and Last Position of Element in Sorted Array 35. Search Insert Position 69. Sqrt(x) 74. Search a 2D Matrix 81. Search in Rotated Sorted Array II 153. Find Minimum in Rotated Sorted Array 154. Find Minimum in Rotated Sorted Array II

哈希表

1. Two Sum 3. Longest Substring Without Repeating Characters 18. 4Sum 30. Substring with Concatenation of All Words 36. Valid Sudoku 49. Group Anagrams 76. Minimum Window Substring 146. LRU Cache 149. Max Points on a Line

并查集

128. Longest Consecutive Sequence

排序

41. First Missing Positive 56. Merge Intervals 57. Insert Interval 147. Insertion Sort List 148. Sort List

深度优先搜索

17. Letter Combinations of a Phone Number 22. Generate Parentheses 37. Sudoku Solver 39. Combination Sum 40. Combination Sum II 46. Permutations 47. Permutations II 51. N-Queens 52. N-Queens II 77. Combinations 78. Subsets 79. Word Search 90. Subsets II 93. Restore IP Addresses 130. Surrounded Regions

广度优先搜索

126. Word Ladder II 127. Word Ladder

分治

23. Merge k Sorted Lists

贪心

44. Wildcard Matching 45. Jump Game II 55. Jump Game 122. Best Time to Buy and Sell Stock II 134. Gas Station 135. Candy

动态规划

5. Longest Palindromic Substring 10. Regular Expression Matching 53. Maximum Subarray 62. Unique Paths 63. Unique Paths II 64. Minimum Path Sum 70. Climbing Stairs 72. Edit Distance 87. Scramble String 91. Decode Ways 97. Interleaving String 115. Distinct Subsequences 120. Triangle 121. Best Time to Buy and Sell Stock 123. Best Time to Buy and Sell Stock III 131. Palindrome Partitioning 132. Palindrome Partitioning II 139. Word Break 140. Word Break II 152. Maximum Product Subarray

数学

7. Reverse Integer 9. Palindrome Number 12. Integer to Roman 13. Roman to Integer 29. Divide Two Integers 43. Multiply Strings 50. Pow(x, n) 66. Plus One

位操作

89. Gray Code 136. Single Number 137. Single Number II

LeetCode算法

本作品根据 署名-非商业性使用-相同方式共享 4.0 国际许可 进行授权。

在 Java 中使用 Map 计数的几种姿势

Best Time to Buy and Sell Stock III