Skip to content

Java Solutions to problems on LintCode/LeetCode

Notifications You must be signed in to change notification settings

holycloud/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给我.

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

About

Java Solutions to problems on LintCode/LeetCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java100.0%