Skip to content

cedarz/ltcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode

# problem Solution
1 Two Sum Solution 1
2 Add Two Numbers Solution 2
3 Longest Substring Without Repeating Characters Solution 3
4 Median of Two Sorted Arrays Solution 4
5 Longest Palindromic Substring Solution 5
6 ZigZag Conversion Solution 6
7 Reverse Integer Solution 7
8 String to Integer (atoi) Solution 8
9 Palindrome Number Solution 9
10 Regular Expression Matching Solution 10
11 Container With Most Water Solution 11
12 Integer to Roman Solution 12
13 Roman to Integer Solution 13
14 Longest Common Prefix Solution 14
15 3Sum Solution 15
16 3Sum Closest Solution 16
17 Letter Combinations of a Phone Number Solution 17
18 4Sum Solution 18
19 Remove Nth Node From End of List Solution 19
20 Valid Parentheses Solution 20
21 Merge Two Sorted Lists Solution 21
22 Generate Parentheses Solution 22
23 Merge k Sorted Lists Solution 23
24 Swap Nodes in Pairs Solution 24
25 Reverse Nodes in k-Group Solution 25
26 Remove Duplicates from Sorted Array Solution 26
27 Remove Element Solution 27
28 Implement strStr() Solution 28
29 Divide Two Integers Solution 29
30 Substring with Concatenation of All Words Solution 30
31 Next Permutation Solution 31
32 Longest Valid Parentheses Solution 32
33 Search in Rotated Sorted Array Solution 33
34 Search for a Range Solution 34
35 Search Insert Position Solution 35
36 Valid Sudoku Solution 36
37 Sudoku Solver Solution 37
38 Count and Say Solution 38
39 Combination Sum Solution 39
40 Combination Sum II Solution 40
41 First Missing Positive Solution 41
42 Trapping Rain Water Solution 42
43 Multiply Strings Solution 43
44 Wildcard Matching Solution 44
45 Jump Game II Solution 45
46 Permutations Solution 46
47 Permutations II Solution 47
48 Rotate Image Solution 48
49 Group Anagrams Solution 49
50 Pow(x, n) Solution 50
51 N-Queens Solution 51
52 N-Queens II Solution 52
53 Maximum Subarray Solution 53
54 Spiral Matrix Solution 54
55 Jump Game Solution 55
56 Merge Intervals Solution 56
57 Insert Interval Solution 57
58 Length of Last Word Solution 58
59 Spiral Matrix II Solution 59
60 Permutation Sequence Solution 60
61 Rotate List Solution 61
62 Unique Paths Solution 62
63 Unique Paths II Solution 63
64 Minimum Path Sum Solution 64
65 Valid Number Solution 65
66 Plus One Solution 66
67 Add Binary Solution 67
68 Text Justification Solution 68
69 Sqrt(x) Solution 69
70 Climbing Stairs Solution 70
71 Simplify Path Solution 71
72 Edit Distance Solution 72
73 Set Matrix Zeroes Solution 73
74 Search a 2D Matrix Solution 74
75 Sort Colors Solution 75
76 Minimum Window Substring Solution 76
77 Combinations Solution 77
78 Subsets Solution 78
79 Word Search Solution 79
80 Remove Duplicates from Sorted Array II Solution 80
81 Search in Rotated Sorted Array II Solution 81
82 Remove Duplicates from Sorted List II Solution 82
83 Remove Duplicates from Sorted List Solution 83
84 Largest Rectangle in Histogram Solution 84
85 Maximal Rectangle Solution 85
86 Partition List Solution 86
87 Scramble String Solution 87
88 Merge Sorted Array Solution 88
89 Gray Code Solution 89
90 Subsets II Solution 90
91 Decode Ways Solution 91
92 Reverse Linked List II Solution 92
93 Restore IP Addresses Solution 93
94 Binary Tree Inorder Traversal Solution 94
95 Unique Binary Search Trees II Solution 95
96 Unique Binary Search Trees Solution 96
97 Interleaving String Solution 97
98 Validate Binary Search Tree Solution 98
99 Recover Binary Search Tree Solution 99
100 Same Tree Solution 100
101 Symmetric Tree Solution 101
102 Binary Tree Level Order Traversal Solution 102
103 Binary Tree Zigzag Level Order Traversal Solution 103
104 Maximum Depth of Binary Tree Solution 104
105 Construct Binary Tree from Preorder and Inorder Traversal Solution 105
106 Construct Binary Tree from Inorder and Postorder Traversal Solution 106
107 Binary Tree Level Order Traversal II Solution 107
108 Convert Sorted Array to Binary Search Tree Solution 108
109 Convert Sorted List to Binary Search Tree Solution 109
110 Balanced Binary Tree Solution 110
111 Minimum Depth of Binary Tree Solution 111
112 Path Sum Solution 112
113 Path Sum II Solution 113
114 Flatten Binary Tree to Linked List Solution 114
115 Distinct Subsequences Solution 115
116 Populating Next Right Pointers in Each Node Solution 116
117 Populating Next Right Pointers in Each Node II Solution 117
118 Pascal's Triangle Solution 118
119 Pascal's Triangle II Solution 119
120 Triangle Solution 120
121 Best Time to Buy and Sell Stock Solution 121
122 Best Time to Buy and Sell Stock II Solution 122
123 Best Time to Buy and Sell Stock III Solution 123
124 Binary Tree Maximum Path Sum Solution 124
125 Valid Palindrome Solution 125
126 Word Ladder II Solution 126
127 Word Ladder Solution 127
128 Longest Consecutive Sequence Solution 128
129 Sum Root to Leaf Numbers Solution 129
130 Surrounded Regions Solution 130
131 Palindrome Partitioning Solution 131
132 Palindrome Partitioning II Solution 132
133 Clone Graph Solution 133
134 Gas Station Solution 134
135 Candy Solution 135
136 Single Number Solution 136
137 Single Number II Solution 137
138 Copy List with Random Pointer Solution 138
139 Word Break Solution 139
140 Word Break II Solution 140
141 Linked List Cycle Solution 141
142 Linked List Cycle II Solution 142
143 Reorder List Solution 143
144 Binary Tree Preorder Traversal Solution 144
145 Binary Tree Postorder Traversal Solution 145
146 LRU Cache Solution 146
147 Insertion Sort List Solution 147
148 Sort List Solution 148
149 Max Points on a Line Solution 149
150 Evaluate Reverse Polish Notation Solution 150
151 Reverse Words in a String Solution 151
152 Maximum Product Subarray Solution 152
153 Find Minimum in Rotated Sorted Array Solution 153
154 Find Minimum in Rotated Sorted Array II Solution 154
155 Min Stack Solution 155
156 Binary Tree Upside Down Solution 156
157 Read N Characters Given Read4 Solution 157
158 Read N Characters Given Read4 II - Call multiple times Solution 158
159 Longest Substring with At Most Two Distinct Characters Solution 159
160 Intersection of Two Linked Lists Solution 160
161 One Edit Distance Solution 161
162 Find Peak Element Solution 162
163 Missing Ranges Solution 163
164 Maximum Gap Solution 164
165 Compare Version Numbers Solution 165
166 Fraction to Recurring Decimal Solution 166
167 Two Sum II - Input array is sorted Solution 167
168 Excel Sheet Column Title Solution 168
169 Majority Element Solution 169
170 Two Sum III - Data structure design Solution 170
171 Excel Sheet Column Number Solution 171
172 Factorial Trailing Zeroes Solution 172
173 Binary Search Tree Iterator Solution 173
174 Dungeon Game Solution 174
179 Largest Number Solution 179
186 Reverse Words in a String II Solution 186
187 Repeated DNA Sequences Solution 187
188 Best Time to Buy and Sell Stock IV Solution 188
189 Rotate Array Solution 189
190 Reverse Bits Solution 190
191 Number of 1 Bits Solution 191
198 House Robber Solution 198
199 Binary Tree Right Side View Solution 199
200 Number of Islands Solution 200
201 Bitwise AND of Numbers Range Solution 201
202 Happy Number Solution 202
203 Remove Linked List Elements Solution 203
204 Count Primes Solution 204
205 Isomorphic Strings Solution 205
206 Reverse Linked List Solution 206
207 Course Schedule Solution 207
208 Implement Trie (Prefix Tree) Solution 208
209 Minimum Size Subarray Sum Solution 209
210 Course Schedule II Solution 210
211 Add and Search Word - Data structure design Solution 211
212 Word Search II Solution 212
213 House Robber II Solution 213
214 Shortest Palindrome Solution 214
215 Kth Largest Element in an Array Solution 215
216 Combination Sum III Solution 216
217 Contains Duplicate Solution 217
218 The Skyline Problem Solution 218
219 Contains Duplicate II Solution 219
220 Contains Duplicate III Solution 220
221 Maximal Square Solution 221
222 Count Complete Tree Nodes Solution 222
223 Rectangle Area Solution 223
224 Basic Calculator Solution 224
225 Implement Stack using Queues Solution 225
226 Invert Binary Tree Solution 226
227 Basic Calculator II Solution 227
228 Summary Ranges Solution 228
229 Majority Element II Solution 229
230 Kth Smallest Element in a BST Solution 230
231 Power of Two Solution 231
232 Implement Queue using Stacks Solution 232
233 Number of Digit One Solution 233
234 Palindrome Linked List Solution 234
235 Lowest Common Ancestor of a Binary Search Tree Solution 235
236 Lowest Common Ancestor of a Binary Tree Solution 236
237 Delete Node in a Linked List Solution 237
238 Product of Array Except Self Solution 238
239 Sliding Window Maximum Solution 239
240 Search a 2D Matrix II Solution 240
241 Different Ways to Add Parentheses Solution 241
242 Valid Anagram Solution 242
243 Shortest Word Distance Solution 243
244 Shortest Word Distance II Solution 244
245 Shortest Word Distance III Solution 245
246 Strobogrammatic Number Solution 246
247 Strobogrammatic Number II Solution 247
248 Strobogrammatic Number III Solution 248
249 Group Shifted Strings Solution 249
250 Count Univalue Subtrees Solution 250
251 Flatten 2D Vector Solution 251
252 Meeting Rooms Solution 252
253 Meeting Rooms II Solution 253
254 Factor Combinations Solution 254
255 Verify Preorder Sequence in Binary Search Tree Solution 255
256 Paint House Solution 256
257 Binary Tree Paths Solution 257
258 Add Digits Solution 258
259 3Sum Smaller Solution 259
260 Single Number III Solution 260
261 Graph Valid Tree Solution 261
263 Ugly Number Solution 263
264 Ugly Number II Solution 264
265 Paint House II Solution 265
266 Palindrome Permutation Solution 266
267 Palindrome Permutation II Solution 267
268 Missing Number Solution 268
269 Alien Dictionary Solution 269
270 Closest Binary Search Tree Value Solution 270
271 Encode and Decode Strings Solution 271
272 Closest Binary Search Tree Value II Solution 272
273 Integer to English Words Solution 273
274 H-Index Solution 274
275 H-Index II Solution 275
276 Paint Fence Solution 276
277 Find the Celebrity Solution 277
278 First Bad Version Solution 278
279 Perfect Squares Solution 279
280 Wiggle Sort Solution 280
281 Zigzag Iterator Solution 281
282 Expression Add Operators Solution 282
283 Move Zeroes Solution 283
284 Peeking Iterator Solution 284
285 Inorder Successor in BST Solution 285
286 Walls and Gates Solution 286
287 Find the Duplicate Number Solution 287
288 Unique Word Abbreviation Solution 288
289 Game of Life Solution 289
290 Word Pattern Solution 290
291 Word Pattern II Solution 291
292 Nim Game Solution 292
293 Flip Game Solution 293
294 Flip Game II Solution 294
295 Find Median from Data Stream Solution 295
296 Best Meeting Point Solution 296
297 Serialize and Deserialize Binary Tree Solution 297
298 Binary Tree Longest Consecutive Sequence Solution 298
299 Bulls and Cows Solution 299
300 Longest Increasing Subsequence Solution 300
301 Remove Invalid Parentheses Solution 301
302 Smallest Rectangle Enclosing Black Pixels Solution 302
303 Range Sum Query - Immutable Solution 303
304 Range Sum Query 2D - Immutable Solution 304
305 Number of Islands II Solution 305
306 Additive Number Solution 306
307 Range Sum Query - Mutable Solution 307
308 Range Sum Query 2D - Mutable Solution 308
309 Best Time to Buy and Sell Stock with Cooldown Solution 309
310 Minimum Height Trees Solution 310
311 Sparse Matrix Multiplication Solution 311
312 Burst Balloons Solution 312
313 Super Ugly Number Solution 313
314 Binary Tree Vertical Order Traversal Solution 314
315 Count of Smaller Numbers After Self Solution 315
316 Remove Duplicate Letters Solution 316
317 Shortest Distance from All Buildings Solution 317
318 Maximum Product of Word Lengths Solution 318
319 Bulb Switcher Solution 319
320 Generalized Abbreviation Solution 320
321 Create Maximum Number Solution 321
322 Coin Change Solution 322
323 Number of Connected Components in an Undirected Graph Solution 323
324 Wiggle Sort II Solution 324
325 Maximum Size Subarray Sum Equals k Solution 325
326 Power of Three Solution 326
327 Count of Range Sum Solution 327
328 Odd Even Linked List Solution 328
329 Longest Increasing Path in a Matrix Solution 329
330 Patching Array Solution 330
331 Verify Preorder Serialization of a Binary Tree Solution 331
332 Reconstruct Itinerary Solution 332
333 Largest BST Subtree Solution 333
334 Increasing Triplet Subsequence Solution 334
335 Self Crossing Solution 335
336 Palindrome Pairs Solution 336
337 House Robber III Solution 337
338 Counting Bits Solution 338
339 Nested List Weight Sum Solution 339
340 Longest Substring with At Most K Distinct Characters Solution 340
341 Flatten Nested List Iterator Solution 341
342 Power of Four Solution 342
343 Integer Break Solution 343
344 Reverse String Solution 344
345 Reverse Vowels of a String Solution 345
346 Moving Average from Data Stream Solution 346
347 Top K Frequent Elements Solution 347
348 Design Tic-Tac-Toe Solution 348
349 Intersection of Two Arrays Solution 349
350 Intersection of Two Arrays II Solution 350
351 Android Unlock Patterns Solution 351
352 Data Stream as Disjoint Intervals Solution 352
353 Design Snake Game Solution 353
354 Russian Doll Envelopes Solution 354
355 Design Twitter Solution 355
356 Line Reflection Solution 356
357 Count Numbers with Unique Digits Solution 357
358 Rearrange String k Distance Apart Solution 358
359 Logger Rate Limiter Solution 359
360 Sort Transformed Array Solution 360
361 Bomb Enemy Solution 361
362 Design Hit Counter Solution 362
363 Max Sum of Rectangle No Larger Than K Solution 363
364 Nested List Weight Sum II Solution 364
365 Water and Jug Problem Solution 365
366 Find Leaves of Binary Tree Solution 366
367 Valid Perfect Square Solution 367
368 Largest Divisible Subset Solution 368
369 Plus One Linked List Solution 369
370 Range Addition Solution 370
371 Sum of Two Integers Solution 371
372 Super Pow Solution 372
373 Find K Pairs with Smallest Sums Solution 373
374 Guess Number Higher or Lower Solution 374
375 Guess Number Higher or Lower II Solution 375
376 Wiggle Subsequence Solution 376
377 Combination Sum IV Solution 377
378 Kth Smallest Element in a Sorted Matrix Solution 378
379 Design Phone Directory Solution 379
380 Insert Delete GetRandom O(1) Solution 380
381 Insert Delete GetRandom O(1) - Duplicates allowed Solution 381
382 Linked List Random Node Solution 382
383 Ransom Note Solution 383
384 Shuffle an Array Solution 384
385 Mini Parser Solution 385
386 Lexicographical Numbers Solution 386
387 First Unique Character in a String Solution 387
388 Longest Absolute File Path Solution 388
389 Find the Difference Solution 389
390 Elimination Game Solution 390
391 Perfect Rectangle Solution 391
392 Is Subsequence Solution 392
393 UTF-8 Validation Solution 393
394 Decode String Solution 394
395 Longest Substring with At Least K Repeating Characters Solution 395
396 Rotate Function Solution 396
397 Integer Replacement Solution 397
398 Random Pick Index Solution 398
399 Evaluate Division Solution 399
400 Nth Digit Solution 400

About

About the leetcode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published