Skip to content

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

About

Java Solutions to problems on LintCode/LeetCode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%