Skip to content

2breakegg/LintCode

 
 

Repository files navigation

Java Algorithm Problems

前戏

To host Java Solutions to algorithm problems from LintCode, LeetCode...etc. I Will try to revise the solutions once new problem or new testing case occurs. Mid 2016 I realize that people may want to contribute to this repo, and make it better by contributing fixes, better solutions ... etc. Free free to send pull request. Once verified, I'm happy to merge in! CALM DOWN AND CODE ON! Fellows!

News

2017年1月17日, 陪我征战多年的 2014 MackBookPro i7 3.xGHz 被一杯清水结束了生命,在这里深切缅怀悼念。这个Git Repo是小M陪我一字一句打出来的,有过蹉跎,也有过辉煌,陪我从Day1刷题一直刷到了Day1之中。直至今日,小M记录的代码还在给广大coder带来福利。为了延续小M无私奉献的精神,我将重新在这个repo活跃起来,重整已有的问题,也会尝试总结一些System Design方面的想法,将小M还没有能够达成的梦想实现。

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

About

Java Solutions to problems on LintCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%