Announcement

Do you have an interview question that you think should be included in LeetCode?

Contribute by posting it here in our NEW discussion forum.

CONGRATULATIONS

You have confirmed your email successfully. Please read the FAQ or click here to complete your profile.

Welcome, ! You have solved problems. (manage sessions)

Favorite
348 Design Tic-Tac-Toe 47.2% Medium
347 Top K Frequent Elements 44.3% Medium
346 Moving Average from Data Stream 67.4% Easy
345 Reverse Vowels of a String 35.1% Easy
344 Reverse String 58.6% Easy
343 Integer Break 40.5% Medium
342 Power of Four 33.5% Easy
341 Flatten Nested List Iterator 23.9% Medium
340 Longest Substring with At Most K Distinct Characters 37.3% Hard
339 Nested List Weight Sum 54.3% Easy
338 Counting Bits 55.7% Medium
337 House Robber III 37.0% Medium
336 Palindrome Pairs 19.6% Hard
335 Self Crossing 19.3% Hard
334 Increasing Triplet Subsequence 33.3% Medium
333 Largest BST Subtree 26.6% Medium
332 Reconstruct Itinerary 24.0% Medium
331 Verify Preorder Serialization of a Binary Tree 31.7% Medium
330 Patching Array 29.2% Medium
329 Longest Increasing Path in a Matrix 31.7% Hard
328 Odd Even Linked List 38.0% Medium
327 Count of Range Sum 26.3% Hard
326 Power of Three 36.7% Easy
325 Maximum Size Subarray Sum Equals k 40.0% Easy
324 Wiggle Sort II 22.4% Medium
323 Number of Connected Components in an Undirected Graph 42.9% Medium
322 Coin Change 24.9% Medium
321 Create Maximum Number 20.9% Hard
320 Generalized Abbreviation 40.8% Medium
319 Bulb Switcher 40.5% Medium
318 Maximum Product of Word Lengths 39.7% Medium
317 Shortest Distance from All Buildings 31.4% Hard
316 Remove Duplicate Letters 25.1% Hard
315 Count of Smaller Numbers After Self 30.5% Hard
314 Binary Tree Vertical Order Traversal 30.7% Medium
313 Super Ugly Number 34.2% Medium
312 Burst Balloons 36.7% Hard
311 Sparse Matrix Multiplication 46.8% Medium
310 Minimum Height Trees 26.6% Medium
309 Best Time to Buy and Sell Stock with Cooldown 36.6% Medium
308 Range Sum Query 2D - Mutable 21.4% Hard
307 Range Sum Query - Mutable 17.3% Medium
306 Additive Number 25.6% Medium
305 Number of Islands II 34.2% Hard
304 Range Sum Query 2D - Immutable 22.2% Medium
303 Range Sum Query - Immutable 24.4% Easy
302 Smallest Rectangle Enclosing Black Pixels 39.2% Hard
301 Remove Invalid Parentheses 32.0% Hard
300 Longest Increasing Subsequence 34.3% Medium
299 Bulls and Cows 29.6% Easy
298 Binary Tree Longest Consecutive Sequence 37.1% Medium
297 Serialize and Deserialize Binary Tree 27.9% Hard
296 Best Meeting Point 46.9% Hard
295 Find Median from Data Stream 22.2% Hard
294 Flip Game II 41.5% Medium
293 Flip Game 49.7% Easy
292 Nim Game 52.9% Easy
291 Word Pattern II 35.1% Hard
290 Word Pattern 29.2% Easy
289 Game of Life 34.4% Medium
288 Unique Word Abbreviation 15.6% Easy
287 Find the Duplicate Number 38.8% Hard
286 Walls and Gates 37.4% Medium
285 Inorder Successor in BST 35.6% Medium
284 Peeking Iterator 33.6% Medium
283 Move Zeroes 44.3% Easy
282 Expression Add Operators 25.0% Hard
281 Zigzag Iterator 43.0% Medium
280 Wiggle Sort 49.6% Medium
279 Perfect Squares 32.7% Medium
278 First Bad Version 22.5% Easy
277 Find the Celebrity 35.2% Medium
276 Paint Fence 30.9% Easy
275 H-Index II 32.6% Medium
274 H-Index 29.5% Medium
273 Integer to English Words 18.7% Hard
272 Closest Binary Search Tree Value II 33.3% Hard
271 Encode and Decode Strings 27.2% Medium
270 Closest Binary Search Tree Value 34.4% Easy
269 Alien Dictionary 23.1% Hard
268 Missing Number 40.2% Medium
267 Palindrome Permutation II 27.7% Medium
266 Palindrome Permutation 50.3% Easy
265 Paint House II 35.6% Hard
264 Ugly Number II 28.1% Medium
263 Ugly Number 36.7% Easy
261 Graph Valid Tree 32.7% Medium
260 Single Number III 43.8% Medium
259 3Sum Smaller 38.3% Medium
258 Add Digits 48.5% Easy
257 Binary Tree Paths 28.6% Easy
256 Paint House 42.8% Medium
255 Verify Preorder Sequence in Binary Search Tree 37.2% Medium
254 Factor Combinations 34.8% Medium
253 Meeting Rooms II 34.7% Medium
252 Meeting Rooms 41.7% Easy
251 Flatten 2D Vector 34.1% Medium
250 Count Univalue Subtrees 36.4% Medium
249 Group Shifted Strings 31.5% Easy
248 Strobogrammatic Number III 26.8% Hard
247 Strobogrammatic Number II 34.3% Medium
246 Strobogrammatic Number 36.5% Easy
245 Shortest Word Distance III 46.2% Medium
244 Shortest Word Distance II 35.3% Medium
243 Shortest Word Distance 46.5% Easy
242 Valid Anagram 41.8% Easy
241 Different Ways to Add Parentheses 35.0% Medium
240 Search a 2D Matrix II 34.5% Medium
239 Sliding Window Maximum 27.5% Hard
238 Product of Array Except Self 42.8% Medium
237 Delete Node in a Linked List 43.8% Easy
236 Lowest Common Ancestor of a Binary Tree 28.7% Medium
235 Lowest Common Ancestor of a Binary Search Tree 37.7% Easy
234 Palindrome Linked List 28.2% Easy
233 Number of Digit One 24.7% Hard
232 Implement Queue using Stacks 34.0% Easy
231 Power of Two 36.7% Easy
230 Kth Smallest Element in a BST 37.8% Medium
229 Majority Element II 25.6% Medium
228 Summary Ranges 24.3% Medium
227 Basic Calculator II 25.1% Medium
226 Invert Binary Tree 45.5% Easy
225 Implement Stack using Queues 30.5% Easy
224 Basic Calculator 22.3% Hard
223 Rectangle Area 29.9% Easy
222 Count Complete Tree Nodes 25.2% Medium
221 Maximal Square 23.6% Medium
220 Contains Duplicate III 18.5% Medium
219 Contains Duplicate II 30.0% Easy
218 The Skyline Problem 22.2% Hard
217 Contains Duplicate 41.3% Easy
216 Combination Sum III 35.9% Medium
215 Kth Largest Element in an Array 33.3% Medium
214 Shortest Palindrome 19.8% Hard
213 House Robber II 30.7% Medium
212 Word Search II 19.5% Hard
211 Add and Search Word - Data structure design 20.2% Medium
210 Course Schedule II 21.0% Medium
209 Minimum Size Subarray Sum 26.9% Medium
208 Implement Trie (Prefix Tree) 25.3% Medium
207 Course Schedule 27.0% Medium
206 Reverse Linked List 39.6% Easy
205 Isomorphic Strings 29.7% Easy
204 Count Primes 24.4% Easy
203 Remove Linked List Elements 28.7% Easy
202 Happy Number 36.6% Easy
201 Bitwise AND of Numbers Range 30.5% Medium
200 Number of Islands 27.8% Medium
199 Binary Tree Right Side View 34.5% Medium
198 House Robber 34.4% Easy
191 Number of 1 Bits 37.6% Easy
190 Reverse Bits 29.3% Easy
189 Rotate Array 21.2% Easy
188 Best Time to Buy and Sell Stock IV 22.3% Hard
187 Repeated DNA Sequences 25.4% Medium
186 Reverse Words in a String II 29.1% Medium
179 Largest Number 19.1% Medium
174 Dungeon Game 20.9% Hard
173 Binary Search Tree Iterator 34.6% Medium
172 Factorial Trailing Zeroes 32.8% Easy
171 Excel Sheet Column Number 41.7% Easy
170 Two Sum III - Data structure design 23.9% Easy
169 Majority Element 41.3% Easy
168 Excel Sheet Column Title 21.8% Easy
167 Two Sum II - Input array is sorted 47.9% Medium
166 Fraction to Recurring Decimal 15.1% Medium
165 Compare Version Numbers 17.5% Easy
164 Maximum Gap 26.8% Hard
163 Missing Ranges 29.2% Medium
162 Find Peak Element 33.0% Medium
161 One Edit Distance 28.4% Medium
160 Intersection of Two Linked Lists 30.3% Easy
159 Longest Substring with At Most Two Distinct Characters 34.9% Hard
158 Read N Characters Given Read4 II - Call multiple times 23.4% Hard
157 Read N Characters Given Read4 29.5% Easy
156 Binary Tree Upside Down 38.3% Medium
155 Min Stack 22.1% Easy
154 Find Minimum in Rotated Sorted Array II 34.4% Hard
153 Find Minimum in Rotated Sorted Array 36.3% Medium
152 Maximum Product Subarray 22.2% Medium
151 Reverse Words in a String 15.7% Medium
150 Evaluate Reverse Polish Notation 23.6% Medium
149 Max Points on a Line 14.3% Hard
148 Sort List 24.9% Medium
147 Insertion Sort List 29.4% Medium
146 LRU Cache 15.8% Hard
145 Binary Tree Postorder Traversal 35.5% Hard
144 Binary Tree Preorder Traversal 39.9% Medium
143 Reorder List 22.8% Medium
142 Linked List Cycle II 31.5% Medium
141 Linked List Cycle 36.9% Easy
140 Word Break II 19.8% Hard
139 Word Break 25.3% Medium
138 Copy List with Random Pointer 26.1% Hard
137 Single Number II 37.7% Medium
136 Single Number 49.8% Medium
135 Candy 22.5% Hard
134 Gas Station 27.4% Medium
133 Clone Graph 24.9% Medium
132 Palindrome Partitioning II 21.8% Hard
131 Palindrome Partitioning 27.6% Medium
130 Surrounded Regions 16.1% Medium
129 Sum Root to Leaf Numbers 32.7% Medium
128 Longest Consecutive Sequence 32.2% Hard
127 Word Ladder 19.7% Medium
126 Word Ladder II 13.6% Hard
125 Valid Palindrome 23.8% Easy
124 Binary Tree Maximum Path Sum 23.4% Hard
123 Best Time to Buy and Sell Stock III 26.4% Hard
122 Best Time to Buy and Sell Stock II 42.4% Medium
121 Best Time to Buy and Sell Stock 36.1% Easy
120 Triangle 30.2% Medium
119 Pascal's Triangle II 32.3% Easy
118 Pascal's Triangle 33.5% Easy
117 Populating Next Right Pointers in Each Node II 32.8% Hard
116 Populating Next Right Pointers in Each Node 36.5% Medium
115 Distinct Subsequences 28.8% Hard
114 Flatten Binary Tree to Linked List 31.1% Medium
113 Path Sum II 28.3% Medium
112 Path Sum 31.3% Easy
111 Minimum Depth of Binary Tree 30.7% Easy
110 Balanced Binary Tree 34.0% Easy
109 Convert Sorted List to Binary Search Tree 30.5% Medium
108 Convert Sorted Array to Binary Search Tree 37.3% Medium
107 Binary Tree Level Order Traversal II 33.9% Easy
106 Construct Binary Tree from Inorder and Postorder Traversal 29.1% Medium
105 Construct Binary Tree from Preorder and Inorder Traversal 28.7% Medium
104 Maximum Depth of Binary Tree 47.9% Easy
103 Binary Tree Zigzag Level Order Traversal 28.7% Medium
102 Binary Tree Level Order Traversal 32.8% Easy
101 Symmetric Tree 33.9% Easy
100 Same Tree 43.2% Easy
99 Recover Binary Search Tree 26.5% Hard
98 Validate Binary Search Tree 21.0% Medium
97 Interleaving String 22.5% Hard
96 Unique Binary Search Trees 37.5% Medium
95 Unique Binary Search Trees II 29.0% Medium
94 Binary Tree Inorder Traversal 39.7% Medium
93 Restore IP Addresses 23.5% Medium
92 Reverse Linked List II 27.9% Medium
91 Decode Ways 17.5% Medium
90 Subsets II 30.6% Medium
89 Gray Code 36.4% Medium
88 Merge Sorted Array 30.1% Easy
87 Scramble String 26.5% Hard
86 Partition List 29.5% Medium
85 Maximal Rectangle 23.5% Hard
84 Largest Rectangle in Histogram 24.2% Hard
83 Remove Duplicates from Sorted List 36.8% Easy
82 Remove Duplicates from Sorted List II 26.9% Medium
81 Search in Rotated Sorted Array II 32.0% Medium
80 Remove Duplicates from Sorted Array II 32.8% Medium
79 Word Search 23.0% Medium
78 Subsets 31.5% Medium
77 Combinations 34.3% Medium
76 Minimum Window Substring 21.3% Hard
75 Sort Colors 34.7% Medium
74 Search a 2D Matrix 33.8% Medium
73 Set Matrix Zeroes 33.5% Medium
72 Edit Distance 28.6% Hard
71 Simplify Path 21.9% Medium
70 Climbing Stairs 36.8% Easy
69 Sqrt(x) 25.3% Medium
68 Text Justification 16.2% Hard
67 Add Binary 27.5% Easy
66 Plus One 33.7% Easy
65 Valid Number 12.1% Hard
64 Minimum Path Sum 34.9% Medium
63 Unique Paths II 29.4% Medium
62 Unique Paths 36.3% Medium
61 Rotate List 22.9% Medium
60 Permutation Sequence 25.2% Medium
59 Spiral Matrix II 35.0% Medium
58 Length of Last Word 29.3% Easy
57 Insert Interval 23.8% Hard
56 Merge Intervals 25.4% Hard
55 Jump Game 28.3% Medium
54 Spiral Matrix 22.6% Medium
53 Maximum Subarray 36.7% Medium
52 N-Queens II 39.4% Hard
51 N-Queens 26.1% Hard
50 Pow(x, n) 27.9% Medium
49 Group Anagrams 27.6% Medium
48 Rotate Image 34.7% Medium
47 Permutations II 28.0% Medium
46 Permutations 35.8% Medium
45 Jump Game II 25.3% Hard
44 Wildcard Matching 17.5% Hard
43 Multiply Strings 23.5% Medium
42 Trapping Rain Water 32.3% Hard
41 First Missing Positive 23.8% Hard
40 Combination Sum II 27.6% Medium
39 Combination Sum 31.0% Medium
38 Count and Say 29.1% Easy
37 Sudoku Solver 25.0% Hard
36 Valid Sudoku 30.7% Easy
35 Search Insert Position 37.3% Medium
34 Search for a Range 29.2% Medium
33 Search in Rotated Sorted Array 30.3% Hard
32 Longest Valid Parentheses 22.5% Hard
31 Next Permutation 26.5% Medium
30 Substring with Concatenation of All Words 20.8% Hard
29 Divide Two Integers 15.7% Medium
28 Implement strStr() 24.9% Easy
27 Remove Element 33.9% Easy
26 Remove Duplicates from Sorted Array 33.5% Easy
25 Reverse Nodes in k-Group 27.6% Hard
24 Swap Nodes in Pairs 35.2% Easy
23 Merge k Sorted Lists 23.4% Hard
22 Generate Parentheses 37.1% Medium
21 Merge Two Sorted Lists 35.5% Easy
20 Valid Parentheses 29.4% Easy
19 Remove Nth Node From End of List 29.5% Easy
18 4Sum 23.8% Medium
17 Letter Combinations of a Phone Number 28.8% Medium
16 3Sum Closest 29.1% Medium
15 3Sum 18.8% Medium
14 Longest Common Prefix 28.2% Easy
13 Roman to Integer 39.5% Easy
12 Integer to Roman 39.0% Medium
11 Container With Most Water 34.6% Medium
10 Regular Expression Matching 22.0% Hard
9 Palindrome Number 31.7% Easy
8 String to Integer (atoi) 13.5% Easy
7 Reverse Integer 23.6% Easy
6 ZigZag Conversion 24.0% Easy
5 Longest Palindromic Substring 23.1% Medium
4 Median of Two Sorted Arrays 18.7% Hard
3 Longest Substring Without Repeating Characters 22.0% Medium
2 Add Two Numbers 23.1% Medium
1 Two Sum 23.2% Easy
Send Feedback