Skip to content

GhostXu11/LintCode

 
 

Repository files navigation

Java Algorithm Problems

程序员的一天

从开始这个Github已经有将近两年时间, 很高兴这个repo可以帮到有需要的人. 我一直认为, 知识本身是无价的, 因此每逢闲暇, 我就会来维护这个repo, 给刷题的朋友们一些我的想法和见解. 下面来简单介绍一下这个repo:

README.md: 所有所做过的题目

ReviewPage.md: 所有题目的总结和归纳(不断完善中)

KnowledgeHash2.md: 对所做过的知识点的一些笔记

SystemDesign.md: 对系统设计的一些笔记

Future Milestone: 我准备将一些有意思的题目,做成视频的形式给大家参考

希望大家学习顺利, 对未来充满希望(程序员也是找到好老板的!) 有问题可以给我写邮件([email protected]), 或者在GitHub上发issue给我.

Squence Problem Level Language Tags Video Tutorial
0 Anagrams.java Medium Java []
1 Binary Representation.java Hard Java []
2 Binary Tree Level Order Traversal II.java Medium Java []
3 Binary Tree Level Order Traversal.java Medium Java []
4 Binary Tree Longest Consecutive Sequence.java Medium Java []
5 Binary Tree Maximum Path Sum II.java Medium Java []
6 Binary Tree Right Side View.java Medium Java []
7 Binary Tree Serialization.java Medium Java []
8 Binary Tree Zigzag Level Order Traversal.java Medium Java []
9 ColorGrid.java Medium Java []
10 Combination Sum II.java Medium Java []
11 Combination Sum.java Medium Java []
12 Combinations.java Medium Java []
13 Construct Binary Tree from Inorder and Postorder Traversal.java Medium Java []
14 Container With Most Water.java Medium Java []
15 Convert Binary Search Tree to Doubly Linked List.java Medium Java [BST]
16 Convert Expression to Polish Notation.java Hard Java []
17 Convert Expression to Reverse Polish Notation.java Hard Java []
18 Copy List with Random Pointer.java Medium Java []
19 Count of Smaller Number before itself.java Hard Java []
20 Count of Smaller Number.java Medium Java []
21 Count Primes.java Easy Java []
22 Delete Digits.java Medium Java []
23 Delete Node in the Middle of Singly Linked List.java Easy Java []
24 Encode and Decode Strings.java Medium Java []
25 ExcelSheetColumnNumber .java Easy Java []
26 Expression Evaluation.java Hard Java []
27 Expression Tree Build.java Hard Java []
28 Fast Power.java Medium Java []
29 Fibonacci.java Easy Java []
30 Find the Connected Component in the Undirected Graph.java Medium Java []
31 Find the Weak Connected Component in the Directed Graph.java Medium Java []
32 First Missing Positive.java N/A Java []
33 Flatten 2D Vector.java Medium Java []
34 Flip Game II.java Medium Java []
35 Flip Game.java Easy Java []
36 Fraction to Recurring Decimal.java Medium Java []
37 Gas Station.java N/A Java []
38 Generate Parentheses.java Medium Java []
39 Gray Code.java Medium Java []
40 Group Anagrams.java Medium Java []
41 Group Shifted Strings.java Easy Java []
42 H-Index II.java Medium Java []
43 H-Index.java Medium Java []
44 Hamming Distance.java Easy Java []
45 Happy Number.java Easy Java []
46 Hash Function.java Easy Java []
47 HashHeap.java Hard Java []
48 HashWithArray.java Easy Java []
49 HashWithCustomizedClass(LinkedList).java Medium Java []
50 Heapify.java Medium Java []
51 Heaters.java Easy Java []
52 Identical Binary Tree.java Easy Java []
53 Implement Queue by Two Stacks.java N/A Java []
54 Implement Stack by Two Queues.java Easy Java []
55 Implement Stack using Queues.java Easy Java []
56 Implement Stack.java Easy Java []
57 Implement strStr().java N/A Java []
58 Implement Trie (Prefix Tree).java Medium Java []
59 IndexMatch.java Easy Java []
60 Inorder Successor in Binary Search Tree.java Medium Java [BST]
61 Insert Interval.java Easy Java []
62 Insert Node in a Binary Search Tree .java Easy Java [BST]
63 Insertion Sort List.java N/A Java []
64 Integer to English Words.java N/A Java []
65 Interleaving Positive and Negative Numbers.java N/A Java []
66 Intersection of Two Arrays.java Easy Java []
67 Intersection of Two Linked Lists.java Easy Java []
68 Interval Minimum Number.java Medium Java []
69 Interval Sum II.java Hard Java []
70 Interval Sum.java Medium Java []
71 Invert Binary Tree.java Easy Java []
72 Isomorphic Strings.java Easy Java []
73 Jump Game II.java Hard Java []
74 Kth Largest Element.java Medium Java []
75 Kth Smallest Element in a BST.java Medium Java [BST]
76 Kth Smallest Sum In Two Sorted Arrays.java Hard Java []
77 Largest Number.java N/A Java []
78 Last Position of Target.java N/A Java []
79 Length of Last Word.java N/A Java []
80 Longest Common Prefix.java Medium Java []
81 Longest Common Substring.java N/A Java []
82 Longest Consecutive Sequence.java N/A Java []
83 Longest Increasing Continuous subsequence II.java N/A Java []
84 Longest Increasing Continuous subsequence.java Easy Java []
85 Longest Palindromic Substring.java Medium Java []
86 Longest Univalue Path.java Easy Java []
87 Longest Word in Dictionary.java Easy Java []
88 Longest Words.java N/A Java []
89 Lowest Common Ancestor II.java Easy Java []
90 Lowest Common Ancestor of a Binary Search Tree.java Medium Java []
91 Lowest Common Ancestor.java Easy Java []
92 LRU Cache.java Hard Java []
93 Majority Number II.java Medium Java []
94 Majority Number III.java Medium Java []
95 Matrix Zigzag Traversal.java Easy Java []
96 Max Area of Island.java Easy Java []
97 Maximum Depth of Binary Tree.java Easy Java []
98 Maximum Subarray III.java N/A Java []
99 Maximum Subarray.java Easy Java []
100 Maximum SubarrayII.java N/A Java []
101 MaximumSubarrayII.java N/A Java []
102 Median of two Sorted Arrays.java Hard Java []
103 Median.java N/A Java []
104 Merge Intervals.java Easy Java []
105 Merge k Sorted Arrays.java Medium Java []
106 Merge k Sorted Lists.java Medium Java []
107 Merge Sorted Array II.java N/A Java []
108 Merge Sorted Array.java Easy Java []
109 Merge Two Binary Trees.java Easy Java []
110 Merge Two Sorted Lists.java Easy Java []
111 Middle of Linked List.java N/A Java []
112 Minimum Absolute Difference in BST.java Easy Java [BST]
113 Minimum Height Trees.java N/A Java []
114 Minimum Subarray.java N/A Java []
115 MinimumDepthOfBinaryTree.java Easy Java []
116 Missing Ranges.java N/A Java []
117 Multiply Strings.java Medium Java []
118 Next Permutation.java Medium Java []
119 NQueens.java N/A Java []
120 NQueensII.java N/A Java []
121 Nth to Last Node in List.java N/A Java []
122 Number Triangles.java N/A Java []
123 O(1) Check Power of 2.java N/A Java []
124 Paint Fence.java N/A Java []
125 Palindrome Linked List.java N/A Java []
126 Palindrome Partitioning.java N/A Java []
127 Palindrome Permutation II.java Medium Java []
128 Palindrome Permutation.java Easy Java []
129 Partition Array by Odd and Even.java N/A Java []
130 Partition Array.java N/A Java []
131 Partition List.java N/A Java []
132 Pascal's Triangle II.java Easy Java []
133 Peeking Iterator.java Medium Java [BST]
134 Permutation Index.java Easy Java []
135 Permutation Sequence.java Medium Java []
136 Permutations II.java Medium Java []
137 Permutations.java Medium Java []
138 Populating Next Right Pointers in Each Node II.java Hard Java []
139 Product of Array Exclude Itself.java N/A Java []
140 QuickSort.java Easy Java []
141 Recover Rotated Sorted Array.java N/A Java []
142 Rehashing.java Medium Java []
143 Remove Duplicates from Sorted Array.java Easy Java []
144 Remove Duplicates from Sorted List II.java N/A Java []
145 Remove Duplicates from Sorted List.java Easy Java []
146 Remove Duplicates from Unsorted List.java N/A Java []
147 Remove Invalid Parentheses.java Hard Java []
148 Remove Linked List Elements.java N/A Java []
149 Remove Node in Binary Search Tree.java Hard Java [BST]
150 Reorder List.java N/A Java []
151 Reshape the Matrix.java Easy Java []
152 Restore IP Addresses.java N/A Java []
153 Reverse Linked List II .java N/A Java []
154 Reverse Linked List.java Easy Java []
155 Reverse String.java Easy Java []
156 Reverse Words in a String II.java Medium Java []
157 Reverse Words in a String.java Medium Java []
158 Roman to Integer.java Easy Java []
159 Rotate Image.java Medium Java []
160 Rotate List.java N/A Java []
161 Rotate String.java N/A Java []
162 Russian Doll Envelopes.java N/A Java []
163 Search a 2D Matrix II.java N/A Java []
164 Search a 2D Matrix.java N/A Java []
165 Search for a Range.java N/A Java []
166 Search Insert Position.java N/A Java []
167 Search Range in Binary Search Tree .java Medium Java [BST]
168 Search Rotated in Sorted Array II.java N/A Java []
169 Search Rotated in Sorted Array.java Hard Java []
170 Segment Tree Build II.java Medium Java []
171 Segment Tree Build.java Medium Java []
172 Segment Tree Modify.java Medium Java []
173 Segment Tree Query II.java Medium Java []
174 Segment Tree Query.java Medium Java []
175 Serilization and Deserialization Of Binary Tree.java N/A Java []
176 Shortest Word Distance.java Easy Java []
177 Single Number II.java N/A Java []
178 Single Number III.java N/A Java []
179 Single Number.java Easy Java []
180 Singleton.java N/A Java []
181 Sliding Window Maximum.java N/A Java []
182 Sort Color.java N/A Java []
183 Sort Colors II.java N/A Java []
184 Sort Letters by Case.java N/A Java []
185 Sort List.java N/A Java []
186 Space Replacement.java N/A Java []
187 Stone Game.java N/A Java []
188 String Permutation.java Easy Java []
189 String to Integer(atoi).java Easy Java []
190 Strobogrammatic Number II.java Medium Java []
191 Strobogrammatic Number.java Easy Java []
192 StrStr.java N/A Java []
193 Subarray Sum Closest.java Medium Java []
194 Subarray Sum.java Easy Java []
195 Subset.java Medium Java []
196 Subsets II.java Medium Java []
197 Subtree.java Easy Java []
198 Summary Ranges.java N/A Java []
199 Symmetric Binary Tree.java Easy Java []
200 The Smallest Difference.java N/A Java []
201 Top K Frequent Elements.java Medium Java []
202 Top K Frequent Words.java Medium Java []
203 Topological Sorting.java Medium Java []
204 Total Occurrence of Target.java N/A Java []
205 Trailing Zeros.java N/A Java []
206 Tweaked Identical Binary Tree.java Easy Java []
207 Two Lists Sum.java N/A Java []
208 Two Strings Are Anagrams.java Easy Java []
209 Ugly Number II.java N/A Java []
210 Ugly Number.java Medium Java []
211 Unique Binary Search Tree II.java Medium Java [BST]
212 Unique Characters.java N/A Java []
213 Unique Word Abbreviation.java N/A Java []
214 Valid Palindrome.java Easy Java []
215 Valid Parentheses.java Easy Java []
216 Valid Sudoku.java Easy Java []
217 Word Break.java Medium Java []
218 Word Ladder II.java Hard Java []
219 Word Ladder.java Medium Java []
220 Word Pattern.java Easy Java []
221 Zigzag Iterator.java Medium Java [BST]
222 Find Anagram Mappings.java Easy Java [Hash Table]
223 Judge Route Circle.java Easy Java [String]
224 Island Perimeter.java Easy Java [Hash Table]
225 First Unique Character in a String.java Easy Java [Hash Table, String]
226 Power of Three.java Easy Java [Math]
227 Plus One.java Easy Java [Array, Math]
228 Power of Two.java Easy Java [Bit Manipulation, Math]
229 Reverse Vowels of a String.java Easy Java [String, Two Pointers]
230 Guess Number Higher or Lower.java Easy Java [Binary Search]
231 Encode and Decode TinyURL.java Medium Java [Hash Table, Math]
232 Wiggle Sort.java Medium Java [Array, Sort]
233 Queue Reconstruction by Height.java Medium Java [Greedy]
234 2 Sum.java Easy Java [Array, Hash Table]
235 2 Sum II - Input array is sorted.java Medium Java [Array, Binary Search, Two Pointers]
236 2 Sum II.java Medium Java [Array, Binary Search, Two Pointers]
237 Coin Change.java Medium Java [DP]
238 Jump Game.java Medium Java [Array, Greedy]
239 Maximum Product Subarray.java Medium Java [Array, DP]
240 3 Sum Closest.java Medium Java [Array, Two Pointers]
241 Triangle Count.java Medium Java [Array]
242 3 Sum.java Medium Java [Array, Two Pointers]
243 4 Sum.java Medium Java [Hash Table]
244 k Sum.java Hard Java [DP]
245 Longest Continuous Increasing Subsequence.java Easy Java [Array, DP]
246 Longest Increasing Subsequence.java Medium Java [Binary Search, DP, Memoization, Sequence DP]
247 Unique Binary Search Tree.java Medium Java [BST, DP, Tree]
248 Trim a Binary Search Tree.java Easy Java [BST, Tree]
249 Unique Paths II.java Medium Java [Array, DP]
250 Counting Bits.java Medium Java [Bit Manipulation, DP]
251 Bomb Enemy.java Medium Java [DP]
252 Paint House.java Easy Java [DP]
253 Decode Ways.java Review Java [DP, String]
254 House Robber.java Easy Java [DP, Sequence DP]
255 House Robber II.java Medium Java [DP, Sequence DP]
256 Best Time to Buy and Sell Stock I.java Easy Java [Array, DP]
257 Best Time to Buy and Sell Stock II.java Easy Java [Array, Greedy]
258 Best Time to Buy and Sell Stock III .java Hard Java [Array, DP]
259 Best Time to Buy and Sell Stock IV.java Hard Java [DP]
260 Paint House II.java Review Java [DP]
261 3 Sum Smaller.java Medium Java [Array, Two Pointers]
262 Array Partition I.java Easy Java [Array]
263 1-bit and 2-bit Characters.java Easy Java [Array]
264 Non-decreasing Array.java Easy Java [Array]
265 Max Consecutive Ones.java Easy Java [Array]
266 Find All Numbers Disappeared in an Array.java Easy Java [Array]
267 Maximum Average Subarray I.java Easy Java [Array]
268 Largest Number At Least Twice of Others.java Easy Java [Array]
269 Toeplitz Matrix.java Easy Java [Array]
270 Backpack.java Medium Java [DP]
271 Sum of Two Integers.java Easy Java [Bit Manipulation]
272 Swap Bits.java Easy Java [Bit Manipulation]
273 Update Bits.java Medium Java [Bit Manipulation]
274 Maximum XOR of Two Numbers in an Array.java Medium Java [Bit Manipulation, Trie]
275 Perfect Squares.java Medium Java [BFS, DP, Math]
276 Palindrome Partitioning II.java Hard Java [DP]
277 Backpack V.java Medium Java [DP]
278 Backpack VI.java Medium Java [DP]
279 Copy Books.java Hard Java [Binary Search, DP]
280 Valid Perfect Square.java Review Java [Binary Search, Math]
281 Intersection of Two Arrays II.java Easy Java [Binary Search, Hash Table, Sort, Two Pointers]
282 Backpack II.java Medium Java [DP]
283 Backpack III.java Review Java [DP]
284 Longest Palindromic Subsequence.java Medium Java [DP]
285 Scramble String.java Hard Java [DP, Range DP, String]
286 Binary Search Tree Iterator.java Medium Java [BST, Design, Stack, Tree]
287 Flatten Nested List Iterator.java Medium Java [Design, Stack]
288 Best Time to Buy and Sell Stock with Cooldown.java Medium Java [DP]
289 Find Peak Element.java Medium Java [Array, Binary Search]
290 Longest Common Subsequence.java Medium Java [DP, Double Sequence DP]
291 Interleaving String.java Hard Java [DP, String]
292 Letter Combinations of a Phone Number.java Medium Java [Backtracking, String]
293 Edit Distance.java Hard Java [DP, Double Sequence DP, String]
294 Distinct Subsequences.java Hard Java [DP, String]
295 Regular Expression Matching.java Review Java [Backtracking, DP, String]
296 Majority Element.java Easy Java [Array, Bit Manipulation, Divide and Conquer]
297 Wildcard Matching.java Hard Java [Backtracking, DP, Greedy, String]
298 Ones and Zeroes.java Hard Java [DP]
299 Pow(x,n).java Medium Java [Binary Search, Math]
300 Word Break II.java Review Java [Backtracking, DP]
301 Nested List Weight Sum.java Easy Java [DFS]
302 Same Tree.java Easy Java [DFS, Tree]
303 Convert Sorted Array to Binary Search Tree.java Easy Java [DFS, Tree]
304 Binary Tree Maximum Path Sum.java Review Java [DFS, Tree]
305 Construct Binary Tree from Inorder and Preorder Traversal.java Medium Java [Array, DFS, Tree]
306 Path Sum.java Easy Java [DFS, Tree]
307 Add Binary.java Easy Java [Math, String]
308 Add Digits.java Easy Java [Math]
309 Add Two Numbers.java Medium Java [Linked List, Math]
310 Add Two Numbers II.java Medium Java [Linked List]
311 Balanced Binary Tree.java Medium Java [DFS, Tree]
312 Valid Anagram.java Easy Java [Hash Table, Sort]
313 Populating Next Right Pointers in Each Node.java Medium Java [DFS, Tree]
314 Validate Binary Search Tree.java Medium Java [BST, DFS, Tree]
315 Convert Sorted List to Binary Search Tree.java Medium Java [DFS, Linked List]
316 Flatten Binary Tree to Linked List.java Medium Java [Binary Tree, DFS]
317 Binary Tree Paths.java Easy Java [Binary Tree, DFS]
318 Minimum Size Subarray Sum.java Medium Java [Array, Binary Search, Two Pointers]
319 Clone Graph.java Medium Java [BFS, DFS, Graph]
320 Longest Substring Without Repeating Characters.java Medium Java [Hash Table, String, Two Pointers]
321 Minimum Window Substring.java Hard Java [Hash Table, String, Two Pointers]
322 Linked List Cycle.java Easy Java [Linked List, Two Pointers]
323 Remove Nth Node From End of List.java Medium Java [Linked List, Two Pointers]
324 Longest Substring with At Most K Distinct Characters.java Medium Java [Hash Table, String]
325 Linked List Cycle II.java Medium Java [Linked List, Two Pointers]
326 Kth Smallest Number in Sorted Matrix.java Medium Java [Binary Search, Heap]
327 Find Minimum in Rotated Sorted Array.java Medium Java [Array, Binary Search]
328 Find Minimum in Rotated Sorted Array II.java Hard Java [Array, Binary Search]
329 Connecting Graph.java Medium Java [Union Find]
330 Connecting Graph II.java Medium Java [Union Find]
331 Connecting Graph III.java Medium Java [Union Find]
332 Number of Islands.java Medium Java [BFS, DFS, Union Find]
333 Number of Islands II.java Hard Java [Union Find]
334 Graph Valid Tree.java Medium Java [BFS, DFS, Graph, Union Find]
335 Surrounded Regions.java Review Java [BFS, DFS, Union Find]
336 Implement Trie.java Medium Java [Design, Trie]
337 Add and Search Word.java Medium Java [Backtracking, Design, Trie]
338 Word Search II.java Hard Java [Backtracking, DFS, Trie]
339 Word Search.java Medium Java [Array, Backtracking]
340 Word Squares.java Hard Java [Backtracking, Trie]
341 Trapping Rain Water.java Hard Java [Array, Stack, Two Pointers]
342 Trapping Rain Water II.java Hard Java [BFS, Heap]
343 Data Stream Median.java Hard Java [Design, Heap]
344 Sliding Window Median.java Hard Java [Design, Heap]
345 Min Stack.java Easy Java [Design, Stack]
346 Implement Queue using Stacks.java Easy Java [Design, Stack]
347 Expression Expand.java Medium Java [DFS, Divide and Conquer, Stack]
348 Largest Rectangle in Histogram.java Hard Java [Array, Monotonous Stack, Stack]
349 Max Tree.java Medium Java [Stack, Tree]
350 Reverse Integer.java Easy Java [Math]
351 Swap Nodes in Pairs.java Medium Java [Linked List]
352 Find Peak Element II.java Hard Java [Binary Search, DFS, Divide and Conquer]
353 Sqrt(x).java Easy Java [Binary Search, Math]
354 First Bad Version.java Easy Java [Binary Search]
355 Wood Cut.java Medium Java [Binary Search]
356 Find the Duplicate Number.java Medium Java [Array, Binary Search, Two Pointers]
357 Palindrome Pairs.java Hard Java [Hash Table, String, Trie]
358 Game of Life.java Medium Java [Array]
359 Maximum Average Subarray II.java Review Java [Array, Binary Search]
360 Meeting Rooms.java Easy Java [Sort, Sweep Line]
361 Number of Airplane in the sky.java Medium Java [Array, Interval, Sort, Sweep Line]
362 Meeting Rooms II.java Medium Java [Greedy, Heap, Sort, Sweep Line]
363 Building Outline.java Review Java [Binary Indexed Tree, Divide and Conquer, Heap, Segment Tree, Sweep Line]
364 Unique Path.java Medium Java [Array, Coordinate DP, DP]
365 Maximal Rectangle.java Hard Java [Array, DP, Hash Table, Stack]
366 Maximal Square.java Medium Java [Coordinate DP, DP]
367 Minimum Path Sum.java Medium Java [Array, Coordinate DP, DP]
368 House Robber III.java Hard Java [DFS, DP, Status DP, Tree]
369 Longest Increasing Path in a Matrix.java Hard Java [DFS, DP, Memoization, Topological Sort]
370 Coins in a Line.java Medium Java [DP, Game Theory, Greedy]
371 Coins in a Line II.java Medium Java [Array, DP, Game Theory, Memoization, MiniMax]
372 Binary Tree Inorder Traversal.java Easy Java [Hash Table, Stack, Tree]
373 Path Sum II.java Easy Java [DFS, Tree]
374 Binary Tree Postorder Traversal.java Medium Java [Stack, Tree, Two Stacks]
375 Change to Anagram.java Easy Java [String]
376 Classical Binary Search.java Easy Java [Binary Search]
377 Climbing Stairs.java Easy Java [DP, Memoization, Sequence DP]
378 Coins in a Line III.java Hard Java [Array, DP, Game Theory, Interval DP, Memoization]
379 Closest Binary Search Tree Value.java Easy Java [BST, Binary Search, Tree]
380 Compare Version Numbers.java Medium Java [String]
381 Count Complete Tree Nodes.java Medium Java [Binary Search, Tree]
382 Course Schedule.java Medium Java [BFS, DFS, Graph, Topological Sort]
383 Course Schedule II.java Medium Java [BFS, DFS, Graph, Topological Sort]
384 Alien Dictionary.java Hard Java [BFS, Backtracking, DFS, Graph, Topological Sort]
385 Binary Tree Preorder Traversal.java Easy Java [BFS, DFS, Stack, Tree]
386 Closest Number in Sorted Array.java Easy Java [Binary Search]
387 Complete Binary Tree.java Easy Java [BFS, DFS, Tree]
388 Compare Strings.java Easy Java [String]
389 Contains Duplicate.java Easy Java [Array, Hash Table]
390 Contains Duplicate II.java Easy Java [Array, Hash Table]
391 Contains Duplicate III.java Medium Java [BST]
392 Burst Balloons.java Hard Java [DP, Divide and Conquer, Memoization, Range DP]
393 Nim Game.java Easy Java [Brainteaser, DP, Game Theory]
394 Convert Integer A to Integer B.java Easy Java [Bit Manipulation]
395 Cosine Similarity.java Easy Java [Basic Implementation]
396 Count 1 in Binary.java Easy Java [Bit Manipulation]
397 Count and Say.java Easy Java [Basic Implementation, String]
398 One Edit Distance.java Medium Java [String]
399 K Edit Distance.java Hard Java [DP, Double Sequence DP, Trie]

About

Java Solutions to problems on LintCode/LeetCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%