Skip to content

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

About

Java Solutions to problems on LintCode/LeetCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%