Skip to content

XuewenLiao/LintCode

 
 

Repository files navigation

Java Algorithm Problems

程序员的一天

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

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

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

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

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

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

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

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

About

Java Solutions to problems on LintCode/LeetCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%