Author: github.com/lzl124631x
My C++ Code for LeetCode OJ.
Please give this repo a ⭐ if it inspires you. Thanks. 😊
# | Title | Difficulty | Solution |
---|---|---|---|
1 | Two Sum | Easy | Solution |
2 | Add Two Numbers | Medium | Solution |
3 | Longest Substring Without Repeating Characters | Medium | Solution |
5 | Longest Palindromic Substring | Medium | Solution |
6 | ZigZag Conversion | Easy | Solution |
7 | Reverse Integer | Easy | Solution |
9 | Palindrome Number | Easy | Solution |
10 | Regular Expression Matching | Hard | Solution |
11 | Container With Most Water | Medium | Solution |
12 | Integer to Roman | Medium | Solution |
13 | Roman to Integer | Easy | Solution |
14 | Longest Common Prefix | Easy | Solution |
15 | 3Sum | Medium | Solution |
16 | 3Sum Closest | Medium | Solution |
17 | Letter Combinations of a Phone Number | Medium | Solution |
18 | 4Sum | Medium | Solution |
19 | Remove Nth Node From End of List | Easy | Solution |
20 | Valid Parentheses | Easy | Solution |
21 | Merge Two Sorted Lists | Easy | Solution |
22 | Generate Parentheses | Medium | Solution |
23 | Merge k Sorted Lists | Hard | Solution |
24 | Swap Nodes in Pairs | Easy | Solution |
25 | Reverse Nodes in k-Group | Hard | Solution |
26 | Remove Duplicates from Sorted Array | Easy | Solution |
27 | Remove Element | Easy | Solution |
29 | Divide Two Integers | Medium | Solution |
30 | Substring with Concatenation of All Words | Hard | Solution |
31 | Next Permutation | Medium | Solution |
32 | Longest Valid Parentheses | Hard | Solution |
33 | Search in Rotated Sorted Array | Hard | Solution |
34 | Search for a Range | Medium | Solution |
35 | Search Insert Position | Easy | Solution |
36 | Valid Sudoku | Easy | Solution |
38 | Count and Say | Easy | Solution |
39 | Combination Sum | Medium | Solution |
40 | Combination Sum II | Medium | Solution |
42 | Trapping Rain Water | Hard | Solution |
43 | Multiply Strings | Medium | Solution |
45 | Jump Game II | Hard | Solution |
46 | Permutations | Medium | Solution |
47 | Permutations II | Medium | Solution |
48 | Rotate Image | Medium | Solution |
49 | Group Anagrams | Medium | Solution |
53 | Maximum Subarray | Medium | Solution |
54 | Spiral Matrix | Medium | Solution |
55 | Jump Game | Medium | Solution |
58 | Length of Last Word | Easy | Solution |
59 | Spiral Matrix II | Medium | Solution |
60 | Permutation Sequence | Medium | Solution |
61 | Rotate List | Medium | Solution |
62 | Unique Paths | Medium | Solution |
63 | Unique Paths II | Medium | Solution |
66 | Plus One | Easy | Solution |
67 | Add Binary | Easy | Solution |
69 | Sqrt(x) | Medium | Solution |
70 | Climbing Stairs | Easy | Solution |
71 | Simplify Path | Medium | Solution |
72 | Edit Distance | Hard | Solution |
74 | Search a 2D Matrix | Medium | Solution |
75 | Sort Colors | Medium | Solution |
76 | Minimum Window Substring | Hard | Solution |
77 | Combinations | Medium | Solution |
78 | Subsets | Medium | Solution |
79 | Word Search | Medium | Solution |
80 | Remove Duplicates from Sorted Array II | Medium | Solution |
81 | Search in Rotated Sorted Array II | Medium | Solution |
82 | Remove Duplicates from Sorted List II | Medium | Solution |
83 | Remove Duplicates from Sorted List | Easy | Solution |
84 | Largest Rectangle in Histogram | Medium | Solution |
85 | Maximal Rectangle | Hard | Solution |
86 | Partition List | Medium | Solution |
87 | Scramble String | Hard | Solution |
88 | Merge Sorted Array | Easy | Solution |
89 | Gray Code | Medium | Solution |
90 | Subsets II | Medium | Solution |
91 | Decode Ways | Medium | Solution |
92 | Reverse Linked List II | Medium | Solution |
93 | Restore IP Addresses | Medium | Solution |
94 | Binary Tree Inorder Traversal | Medium | Solution |
95 | Unique Binary Search Trees II | Medium | Solution |
96 | Unique Binary Search Trees | Medium | Solution |
98 | Validate Binary Search Tree | Medium | Solution |
100 | Same Tree | Easy | Solution |
101 | Symmetric Tree | Easy | Solution |
102 | Binary Tree Level Order Traversal | Easy | Solution |
103 | Binary Tree Zigzag Level Order Traversal | Medium | Solution |
104 | Maximum Depth of Binary Tree | Easy | Solution |
106 | Construct Binary Tree from Inorder and Postorder Traversal | Medium | Solution |
107 | Binary Tree Level Order Traversal II | Easy | Solution |
108 | Convert Sorted Array to Binary Search Tree | Easy | Solution |
109 | Convert Sorted List to Binary Search Tree | Medium | Solution |
110 | Balanced Binary Tree | Easy | Solution |
111 | Minimum Depth of Binary Tree | Easy | Solution |
112 | Path Sum | Easy | Solution |
113 | Path Sum II | Medium | Solution |
114 | Flatten Binary Tree to Linked List | Medium | Solution |
115 | Distinct Subsequences | Hard | Solution |
116 | Populating Next Right Pointers in Each Node | Medium | Solution |
117 | Populating Next Right Pointers in Each Node II | Medium | Solution |
118 | Pascal's Triangle | Easy | Solution |
119 | Pascal's Triangle II | Easy | Solution |
121 | Best Time to Buy and Sell Stock | Easy | Solution |
122 | Best Time to Buy and Sell Stock II | Medium | Solution |
123 | Best Time to Buy and Sell Stock III | Hard | Solution |
124 | Binary Tree Maximum Path Sum | Hard | Solution |
125 | Valid Palindrome | Easy | Solution |
126 | Word Ladder II | Hard | Solution |
127 | Word Ladder | Hard | Solution |
129 | Sum Root to Leaf Numbers | Medium | Solution |
130 | Surrounded Regions | Medium | Solution |
131 | Palindrome Partitioning | Medium | Solution |
133 | Clone Graph | Medium | Solution |
134 | Gas Station | Medium | Solution |
136 | Single Number | Easy | Solution |
137 | Single Number II | Medium | Solution |
138 | Copy List with Random Pointer | Medium | Solution |
139 | Word Break | Medium | Solution |
140 | Word Break II | Hard | Solution |
141 | Linked List Cycle | Easy | Solution |
142 | Linked List Cycle II | Medium | Solution |
143 | Reorder List | Medium | Solution |
144 | Binary Tree Preorder Traversal | Medium | Solution |
145 | Binary Tree Postorder Traversal | Hard | Solution |
146 | LRU Cache | Hard | Solution |
147 | Insertion Sort List | Medium | Solution |
148 | Sort List | Medium | Solution |
149 | Max Points on a Line | Hard | Solution |
150 | Evaluate Reverse Polish Notation | Medium | Solution |
151 | Reverse Words in a String | Medium | Solution |
152 | Maximum Product Subarray | Medium | Solution |
153 | Find Minimum in Rotated Sorted Array | Medium | Solution |
154 | Find Minimum in Rotated Sorted Array II | Hard | Solution |
156 | Binary Tree Upside Down | Medium | Solution |
157 | Read N Characters Given Read4 | Easy | Solution |
158 | Read N Characters Given Read4 II - Call multiple times | Hard | Solution |
159 | Longest Substring with At Most Two Distinct Characters | Hard | Solution |
161 | One Edit Distance | Medium | Solution |
164 | Maximum Gap | Hard | Solution |
166 | Fraction to Recurring Decimal | Medium | Solution |
167 | Two Sum II - Input array is sorted | Medium | Solution |
169 | Majority Element | Easy | Solution |
173 | Binary Search Tree Iterator | Medium | Solution |
174 | Dungeon Game | Hard | Solution |
175 | Combine Two Tables | Easy | Solution |
176 | Second Highest Salary | Easy | Solution |
181 | Employees Earning More Than Their Managers | Easy | Solution |
182 | Duplicate Emails | Easy | Solution |
188 | Best Time to Buy and Sell Stock IV | Hard | Solution |
190 | Reverse Bits | Easy | Solution |
195 | Tenth Line | Easy | Solution |
198 | House Robber | Easy | Solution |
202 | Happy Number | Easy | Solution |
204 | Count Primes | Easy | Solution |
206 | Reverse Linked List | Easy | Solution |
207 | Course Schedule | Medium | Solution |
208 | Implement Trie (Prefix Tree) | Medium | Solution |
210 | Course Schedule II | Medium | Solution |
211 | Add and Search Word - Data structure design | Medium | Solution |
212 | Word Search II | Hard | Solution |
213 | House Robber II | Medium | Solution |
214 | Shortest Palindrome | Hard | Solution |
215 | Kth Largest Element in an Array | Medium | Solution |
216 | Combination Sum III | Medium | Solution |
218 | The Skyline Problem | Hard | Solution |
221 | Maximal Square | Medium | Solution |
222 | Count Complete Tree Nodes | Medium | Solution |
223 | Rectangle Area | Medium | Solution |
224 | Basic Calculator | Hard | Solution |
225 | Implement Stack using Queues | Easy | Solution |
226 | Invert Binary Tree | Easy | Solution |
227 | Basic Calculator II | Medium | Solution |
229 | Majority Element II | Medium | Solution |
232 | Implement Queue using Stacks | Easy | Solution |
234 | Palindrome Linked List | Easy | Solution |
239 | Sliding Window Maximum | Hard | Solution |
240 | Search a 2D Matrix II | Medium | Solution |
241 | Different Ways to Add Parentheses | Medium | Solution |
243 | Shortest Word Distance | Easy | Solution |
244 | Shortest Word Distance II | Medium | Solution |
246 | Strobogrammatic Number | Easy | Solution |
247 | Strobogrammatic Number II | Medium | Solution |
249 | Group Shifted Strings | Medium | Solution |
250 | Count Univalue Subtrees | Medium | Solution |
252 | Meeting Rooms | Easy | Solution |
253 | Meeting Rooms II | Medium | Solution |
256 | Paint House | Easy | Solution |
257 | Binary Tree Paths | Easy | Solution |
259 | 3Sum Smaller | Medium | Solution |
266 | Palindrome Permutation | Easy | Solution |
260 | Single Number III | Medium | Solution |
261 | Graph Valid Tree | Medium | Solution |
263 | Ugly Number | Easy | Solution |
264 | Ugly Number II | Medium | Solution |
270 | Closest Binary Search Tree Value | Easy | Solution |
271 | Encode and Decode Strings | Medium | Solution |
278 | First Bad Version | Easy | Solution |
279 | Perfect Squares | Medium | Solution |
280 | Wiggle Sort | Medium | Solution |
281 | Zigzag Iterator | Medium | Solution |
285 | Inorder Successor in BST | Medium | Solution |
293 | Flip Game | Easy | Solution |
297 | Serialize and Deserialize Binary Tree | Hard | Solution |
298 | Binary Tree Longest Consecutive Sequence | Medium | Solution |
299 | Bulls and Cows | Easy | Solution |
300 | Longest Increasing Subsequence | Medium | Solution |
301 | Remove Invalid Parentheses | Hard | Solution |
303 | Range Sum Query - Immutable | Easy | Solution |
304 | Range Sum Query 2D - Immutable | Medium | Solution |
307 | Range Sum Query - Mutable | Medium | Solution |
309 | Best Time to Buy and Sell Stock with Cooldown | Hard | Solution |
310 | Minimum Height Trees | Medium | Solution |
313 | Super Ugly Number | Medium | Solution |
315 | Count of Smaller Numbers After Self | Hard | Solution |
316 | Remove Duplicate Letters | Hard | Solution |
320 | Generalized Abbreviation | Medium | Solution |
321 | Create Maximum Number | Hard | Solution |
322 | Coin Change | Medium | Solution |
324 | Wiggle Sort II | Medium | Solution |
327 | Count of Range Sum | Hard | Solution |
328 | Odd Even Linked List | Medium | Solution |
329 | Longest Increasing Path in a Matrix | Hard | Solution |
330 | Patching Array | Hard | Solution |
331 | Verify Preorder Serialization of a Binary Tree | Medium | Solution |
332 | Reconstruct Itinerary | Medium | Solution |
333 | Largest BST Subtree | Medium | Solution |
334 | Increasing Triplet Subsequence | Medium | Solution |
335 | Self Crossing | Hard | Solution |
336 | Palindrome Pairs | Hard | Solution |
337 | House Robber III | Medium | Solution |
338 | Counting Bits | Medium | Solution |
339 | Nested List Weight Sum | Easy | Solution |
340 | Longest Substring with At Most K Distinct Characters | Hard | Solution |
341 | Flatten Nested List Iterator | Medium | Solution |
342 | Power of Four | Easy | Solution |
343 | Integer Break | Medium | Solution |
344 | Reverse String | Easy | Solution |
344 | Reverse String | Easy | Solution |
345 | Reverse Vowels of a String | Easy | Solution |
346 | Moving Average from Data Stream | Easy | Solution |
348 | Design Tic-Tac-Toe | Medium | Solution |
349 | Intersection of Two Arrays | Easy | Solution |
350 | Intersection of Two Arrays II | Easy | Solution |
352 | Data Stream as Disjoint Intervals | Hard | Solution |
354 | Russian Doll Envelopes | Hard | Solution |
355 | Design Twitter | Medium | Solution |
357 | Count Numbers with Unique Digits | Medium | Solution |
359 | Logger Rate Limiter | Easy | Solution |
360 | Sort Transformed Array | Medium | Solution |
361 | Bomb Enemy | Medium | Solution |
363 | Max Sum of Rectangle No Larger Than K | Hard | Solution |
364 | Nested List Weight Sum II | Medium | Solution |
365 | Water and Jug Problem | Medium | Solution |
366 | Find Leaves of Binary Tree | Medium | Solution |
367 | Valid Perfect Square | Easy | Solution |
368 | Largest Divisible Subset | Medium | Solution |
369 | Plus One Linked List | Medium | Solution |
370 | Range Addition | Medium | Solution |
371 | Sum of Two Integers | Easy | Solution |
371 | Sum of Two Integers | Easy | Solution |
372 | Super Pow | Medium | Solution |
373 | Find K Pairs with Smallest Sums | Medium | Solution |
374 | Guess Number Higher or Lower | Easy | Solution |
375 | Guess Number Higher or Lower II | Medium | Solution |
376 | Wiggle Subsequence | Medium | Solution |
377 | Combination Sum IV | Medium | Solution |
378 | Kth Smallest Element in a Sorted Matrix | Medium | Solution |
379 | Design Phone Directory | Medium | Solution |
380 | Insert Delete GetRandom O(1) | Hard | Solution |
381 | Insert Delete GetRandom O(1) - Duplicates allowed | Hard | Solution |
382 | Linked List Random Node | Medium | Solution |
383 | Ransom Note | Easy | Solution |
384 | Shuffle an Array | Medium | Solution |
385 | Mini Parser | Medium | Solution |
386 | Lexicographical Numbers | Medium | Solution |
387 | First Unique Character in a String | Easy | Solution |
388 | Longest Absolute File Path | Medium | Solution |
389 | Find the Difference | Easy | Solution |
390 | Elimination Game | Medium | Solution |
391 | Perfect Rectangle | Hard | Solution |
392 | Is Subsequence | Medium | Solution |
393 | UTF-8 Validation | Medium | Solution |
394 | Decode String | Medium | Solution |
395 | Longest Substring with At Least K Repeating Characters | Medium | Solution |
396 | Rotate Function | Easy | Solution |
397 | Integer Replacement | Medium | Solution |
398 | Random Pick Index | Medium | Solution |
399 | Evaluate Division | Medium | Solution |
400 | Nth Digit | Easy | Solution |
401 | Binary Watch | Easy | Solution |
402 | Remove K Digits | Medium | Solution |
403 | Frog Jump | Hard | Solution |
404 | Sum of Left Leaves | Easy | Solution |
405 | Convert a Number to Hexadecimal | Easy | Solution |
406 | Queue Reconstruction by Height | Medium | Solution |
407 | Trapping Rain Water II | Hard | Solution |
408 | Valid Word Abbreviation | Easy | Solution |
409 | Longest Palindrome | Easy | Solution |
410 | Split Array Largest Sum | Hard | Solution |
412 | Fizz Buzz | Easy | Solution |
412 | Fizz Buzz | Easy | Solution |
413 | Arithmetic Slices | Medium | Solution |
414 | Third Maximum Number | Easy | Solution |
415 | Add Strings | Easy | Solution |
416 | Partition Equal Subset Sum | Medium | Solution |
417 | Pacific Atlantic Water Flow | Medium | Solution |
419 | Battleships in a Board | Medium | Solution |
420 | Strong Password Checker | Hard | Solution |
421 | Maximum XOR of Two Numbers in an Array | Medium | Solution |
422 | Valid Word Square | Easy | Solution |
423 | Reconstruct Original Digits from English | Medium | Solution |
424 | Longest Repeating Character Replacement | Medium | Solution |
427 | Construct Quad Tree | Easy | Solution |
429 | N-ary Tree Level Order Traversal | Easy | Solution |
432 | All O`one Data Structure | Hard | Solution |
434 | Number of Segments in a String | Easy | Solution |
435 | Non-overlapping Intervals | Medium | Solution |
436 | Find Right Interval | Medium | Solution |
437 | Path Sum III | Easy | Solution |
438 | Find All Anagrams in a String | Easy | Solution |
440 | K-th Smallest in Lexicographical Order | Hard | Solution |
441 | Arranging Coins | Easy | Solution |
442 | Find All Duplicates in an Array | Medium | Solution |
443 | String Compression | Easy | Solution |
445 | Add Two Numbers II | Medium | Solution |
446 | Arithmetic Slices II - Subsequence | Hard | Solution |
447 | Number of Boomerangs | Easy | Solution |
448 | Find All Numbers Disappeared in an Array | Easy | Solution |
449 | Serialize and Deserialize BST | Medium | Solution |
450 | Delete Node in a BST | Medium | Solution |
451 | Sort Characters By Frequency | Medium | Solution |
452 | Minimum Number of Arrows to Burst Balloons | Medium | Solution |
453 | Minimum Moves to Equal Array Elements | Easy | Solution |
454 | 4Sum II | Medium | Solution |
455 | Assign Cookies | Easy | Solution |
456 | 132 Pattern | Medium | Solution |
459 | Repeated Substring Pattern | Easy | Solution |
460 | LFU Cache | Hard | Solution |
461 | Hamming Distance | Easy | Solution |
462 | Minimum Moves to Equal Array Elements II | Medium | Solution |
463 | Island Perimeter | Easy | Solution |
464 | Can I Win | Medium | Solution |
466 | Count The Repetitions | Hard | Solution |
467 | Unique Substrings in Wraparound String | Medium | Solution |
468 | Validate IP Address | Medium | Solution |
472 | Concatenated Words | Hard | Solution |
473 | Matchsticks to Square | Medium | Solution |
474 | Ones and Zeroes | Medium | Solution |
475 | Heaters | Easy | Solution |
476 | Number Complement | Easy | Solution |
477 | Total Hamming Distance | Medium | Solution |
478 | Generate Random Point in a Circle | Medium | Solution |
480 | Sliding Window Median | Hard | Solution |
481 | Magical String | Medium | Solution |
482 | License Key Formatting | Medium | Solution |
483 | Smallest Good Base | Hard | Solution |
485 | Max Consecutive Ones | Easy | Solution |
486 | Predict the Winner | Medium | Solution |
487 | Max Consecutive Ones II | Medium | Solution |
488 | Zuma Game | Hard | Solution |
489 | Robot Room Cleaner | Hard | Solution |
490 | The Maze | Medium | Solution |
491 | Increasing Subsequences | Medium | Solution |
492 | Construct the Rectangle | Easy | Solution |
494 | Target Sum | Medium | Solution |
495 | Teemo Attacking | Medium | Solution |
496 | Next Greater Element I | Medium | Solution |
498 | Diagonal Traverse | Medium | Solution |
500 | Keyboard Row | Easy | Solution |
501 | Find Mode in Binary Search Tree | Easy | Solution |
502 | IPO | Hard | Solution |
503 | Next Greater Element II | Medium | Solution |
504 | Base 7 | Easy | Solution |
506 | Relative Ranks | Easy | Solution |
508 | Most Frequent Subtree Sum | Medium | Solution |
509 | Fibonacci Number | Easy | Solution |
513 | Find Bottom Left Tree Value | Medium | Solution |
515 | Find Largest Value in Each Tree Row | Medium | Solution |
516 | Longest Palindromic Subsequence | Medium | Solution |
517 | Super Washing Machines | Hard | Solution |
518 | Coin Change 2 | Medium | Solution |
519 | Random Flip Matrix | Medium | Solution |
520 | Detect Capital | Easy | Solution |
521 | Longest Uncommon Subsequence I | Easy | Solution |
523 | Continuous Subarray Sum | Medium | Solution |
524 | Longest Word in Dictionary through Deleting | Medium | Solution |
525 | Contiguous Array | Medium | Solution |
526 | Beautiful Arrangement | Medium | Solution |
528 | Random Pick with Weight | Medium | Solution |
529 | Minesweeper | Medium | Solution |
530 | Minimum Absolute Difference in BST | Easy | Solution |
532 | K-diff Pairs in an Array | Easy | Solution |
535 | Encode and Decode TinyURL | Medium | Solution |
536 | Construct Binary Tree from String | Medium | Solution |
537 | Complex Number Multiplication | Medium | Solution |
538 | Convert BST to Greater Tree | Medium | Solution |
539 | Minimum Time Difference | Medium | Solution |
540 | Single Element in a Sorted Array | Medium | Solution |
541 | Reverse String II | Easy | Solution |
542 | 01 Matrix | Medium | Solution |
543 | Diameter of Binary Tree | Easy | Solution |
544 | Output Contest Matches | Medium | Solution |
547 | Friend Circles | Medium | Solution |
549 | Binary Tree Longest Consecutive Sequence II | Medium | Solution |
553 | Optimal Division | Medium | Solution |
554 | Brick Wall | Medium | Solution |
556 | Next Greater Element III | Medium | Solution |
557 | Reverse Words in a String III | Easy | Solution |
558 | Quad Tree Intersection | Easy | Solution |
559 | Maximum Depth of N-ary Tree | Easy | Solution |
560 | Subarray Sum Equals K | Medium | Solution |
561 | Array Partition I | Easy | Solution |
562 | Longest Line of Consecutive One in Matrix | Medium | Solution |
563 | Binary Tree Tilt | Easy | Solution |
566 | Reshape the Matrix | Easy | Solution |
567 | Permutation in String | Medium | Solution |
570 | Managers with at Least 5 Direct Reports | Medium | Solution |
572 | Subtree of Another Tree | Easy | Solution |
575 | Distribute Candies | Easy | Solution |
577 | Employee Bonus | Easy | Solution |
581 | Shortest Unsorted Continuous Subarray | Easy | Solution |
582 | Kill Process | Medium | Solution |
583 | Delete Operation for Two Strings | Medium | Solution |
584 | Find Customer Referee | Easy | Solution |
586 | Customer Placing the Largest Number of Orders | Easy | Solution |
589 | N-ary Tree Preorder Traversal | Easy | Solution |
590 | N-ary Tree Postorder Traversal | Easy | Solution |
591 | Tag Validator | Hard | Solution |
594 | Longest Harmonious Subsequence | Easy | Solution |
595 | Big Countries | Easy | Solution |
597 | Friend Requests I: Overall Acceptance Rate | Easy | Solution |
599 | Minimum Index Sum of Two Lists | Easy | Solution |
600 | Non-negative Integers without Consecutive Ones | Hard | Solution |
604 | Design Compressed String Iterator | Easy | Solution |
605 | Can Place Flowers | Easy | Solution |
606 | Construct String from Binary Tree | Easy | Solution |
607 | Sales Person | Easy | Solution |
609 | Find Duplicate File in System | Medium | Solution |
610 | Triangle Judgement | Easy | Solution |
611 | Valid Triangle Number | Medium | Solution |
613 | Shortest Distance in a Line | Easy | Solution |
616 | Add Bold Tag in String | Medium | Solution |
616 | Add Bold Tag in String | Medium | Solution |
617 | Merge Two Binary Trees | Easy | Solution |
620 | Not Boring Movies | Easy | Solution |
622 | Design Circular Queue | Medium | Solution |
627 | Swap Salary | Easy | Solution |
629 | K Inverse Pairs Array | Hard | Solution |
603 | Consecutive Available Seats | Easy | Solution |
636 | Exclusive Time of Functions | Medium | Solution |
637 | Average of Levels in Binary Tree | Easy | Solution |
638 | Shopping Offers | Medium | Solution |
640 | Solve the Equation | Medium | Solution |
643 | Maximum Average Subarray I | Easy | Solution |
647 | Palindromic Substrings | Medium | Solution |
648 | Replace Words | Medium | Solution |
651 | 4 Keys Keyboard | Medium | Solution |
652 | Find Duplicate Subtrees | Medium | Solution |
653 | Two Sum IV - Input is a BST | Easy | Solution |
654 | Maximum Binary Tree | Medium | Solution |
655 | Print Binary Tree | Medium | Solution |
657 | Robot Return to Origin | Easy | Solution |
659 | Split Array into Consecutive Subsequences | Medium | Solution |
662 | Maximum Width of Binary Tree | Medium | Solution |
663 | Equal Tree Partition | Medium | Solution |
666 | Path Sum IV | Medium | Solution |
669 | Trim a Binary Search Tree | Easy | Solution |
670 | Maximum Swap | Medium | Solution |
674 | Longest Continuous Increasing Subsequence | Easy | Solution |
676 | Implement Magic Dictionary | Medium | Solution |
677 | Map Sum Pairs | Medium | Solution |
678 | Valid Parenthesis String | Medium | Solution |
680 | Valid Palindrome II | Easy | Solution |
682 | Baseball Game | Easy | Solution |
684 | Redundant Connection | Medium | Solution |
688 | Knight Probability in Chessboard | Medium | Solution |
690 | Employee Importance | Easy | Solution |
693 | Binary Number with Alternating Bits | Easy | Solution |
694 | Number of Distinct Islands | Medium | Solution |
695 | Max Area of Island | Medium | Solution |
697 | Degree of an Array | Easy | Solution |
700 | Search in a Binary Search Tree | Easy | Solution |
701 | Insert into a Binary Search Tree | Medium | Solution |
702 | Search in a Sorted Array of Unknown Size | Medium | Solution |
703 | Kth Largest Element in a Stream | Easy | Solution |
704 | Binary Search | Easy | Solution |
705 | Design HashSet | Easy | Solution |
706 | Design HashMap | Easy | Solution |
707 | Design Linked List | Easy | Solution |
709 | To Lower Case | Easy | Solution |
712 | Minimum ASCII Delete Sum for Two Strings | Medium | Solution |
718 | Maximum Length of Repeated Subarray | Medium | Solution |
720 | Longest Word in Dictionary | Easy | Solution |
723 | Candy Crush | Medium | Solution |
724 | Find Pivot Index | Easy | Solution |
725 | Split Linked List in Parts | Medium | Solution |
728 | Self Dividing Numbers | Easy | Solution |
733 | Flood Fill | Easy | Solution |
735 | Asteroid Collision | Medium | Solution |
739 | Daily Temperatures | Medium | Solution |
744 | Find Smallest Letter Greater Than Target | Easy | Solution |
745 | Prefix and Suffix Search | Hard | Solution |
746 | Min Cost Climbing Stairs | Easy | Solution |
747 | Largest Number At Least Twice of Others | Easy | Solution |
748 | Shortest Completing Word | Easy | Solution |
750 | Number Of Corner Rectangles | Medium | Solution |
752 | Open the Lock | Medium | Solution |
754 | Reach a Number | Easy | Solution |
755 | Pour Water | Medium | Solution |
760 | Find Anagram Mappings | Easy | Solution |
762 | Prime Number of Set Bits in Binary Representation | Easy | Solution |
763 | Partition Labels | Medium | Solution |
766 | Toeplitz Matrix | Easy | Solution |
767 | Reorganize String | Medium | Solution |
770 | Basic Calculator IV | Hard | Solution |
771 | Jewels and Stones | Easy | Solution |
777 | Swap Adjacent in LR String | Medium | Solution |
783 | Minimum Distance Between BST Nodes | Easy | Solution |
784 | Letter Case Permutation | Easy | Solution |
788 | Rotated Digits | Easy | Solution |
791 | Custom Sort String | Medium | Solution |
794 | Valid Tic-Tac-Toe State | Medium | Solution |
793 | Preimage Size of Factorial Zeroes Function | Hard | Solution |
795 | Number of Subarrays with Bounded Maximum | Medium | Solution |
796 | Rotate String | Easy | Solution |
797 | All Paths From Source to Target | Medium | Solution |
800 | Similar RGB Color | Easy | Solution |
804 | Unique Morse Code Words | Easy | Solution |
806 | Number of Lines To Write String | Easy | Solution |
807 | Max Increase to Keep City Skyline | Medium | Solution |
809 | Expressive Words | Medium | Solution |
811 | Subdomain Visit Count | Easy | Solution |
812 | Largest Triangle Area | Easy | Solution |
817 | Linked List Components | Medium | Solution |
819 | Most Common Word | Easy | Solution |
821 | Shortest Distance to a Character | Easy | Solution |
823 | Binary Trees With Factors | Medium | Solution |
824 | Goat Latin | Easy | Solution |
825 | Friends Of Appropriate Ages | Medium | Solution |
826 | Most Profit Assigning Work | Medium | Solution |
828 | Unique Letter String | Hard | Solution |
829 | Consecutive Numbers Sum | Hard | Solution |
830 | Positions of Large Groups | Easy | Solution |
832 | Flipping an Image | Easy | Solution |
835 | Image Overlap | Medium | Solution |
836 | Rectangle Overlap | Easy | Solution |
840 | Magic Squares In Grid | Easy | Solution |
841 | Keys and Rooms | Medium | Solution |
852 | Peak Index in a Mountain Array | Easy | Solution |
859 | Buddy Strings | Easy | Solution |
856 | Score of Parentheses | Medium | Solution |
860 | Lemonade Change | Easy | Solution |
861 | Score After Flipping Matrix | Medium | Solution |
862 | Shortest Subarray with Sum at Least K | Hard | Solution |
863 | All Nodes Distance K in Binary Tree | Medium | Solution |
867 | Transpose Matrix | Easy | Solution |
868 | Binary Gap | Easy | Solution |
869 | Reordered Power of 2 | Medium | Solution |
870 | Advantage Shuffle | Medium | Solution |
872 | Leaf-Similar Trees | Easy | Solution |
874 | Walking Robot Simulation | Easy | Solution |
875 | Koko Eating Bananas | Medium | Solution |
876 | Middle of the Linked List | Easy | Solution |
877 | Stone Game | Medium | Solution |
881 | Boats to Save People | Medium | Solution |
883 | Projection Area of 3D Shapes | Easy | Solution |
884 | Uncommon Words from Two Sentences | Easy | Solution |
885 | Spiral Matrix III | Medium | Solution |
887 | Super Egg Drop | Hard | Solution |
888 | Fair Candy Swap | Easy | Solution |
889 | Construct Binary Tree from Preorder and Postorder Traversal | Medium | Solution |
890 | Find and Replace Pattern | Medium | Solution |
892 | Surface Area of 3D Shapes | Easy | Solution |
893 | Groups of Special-Equivalent Strings | Easy | Solution |
894 | All Possible Full Binary Trees | Medium | Solution |
897 | Increasing Order Search Tree | Easy | Solution |
896 | Monotonic Array | Easy | Solution |
899 | Orderly Queue | Hard | Solution |
902 | Numbers At Most N Given Digit Set | Hard | Solution |
905 | Sort Array By Parity | Easy | Solution |
906 | Super Palindromes | Hard | Solution |
908 | Smallest Range I | Easy | Solution |
911 | Online Election | Medium | Solution |
912 | Sort an Array | Medium | Solution |
914 | X of a Kind in a Deck of Cards | Easy | Solution |
917 | Reverse Only Letters | Easy | Solution |
919 | Complete Binary Tree Inserter | Medium | Solution |
921 | Minimum Add to Make Parentheses Valid | Medium | Solution |
922 | Sort Array By Parity II | Easy | Solution |
924 | Minimize Malware Spread | Hard | Solution |
926 | Flip String to Monotone Increasing | Medium | Solution |
928 | Minimize Malware Spread II | Hard | Solution |
929 | Unique Email Addresses | Easy | Solution |
931 | Minimum Falling Path Sum | Medium | Solution |
933 | Number of Recent Calls | Easy | Solution |
935 | Knight Dialer | Medium | Solution |
936 | Stamping The Sequence | Hard | Solution |
937 | Reorder Log Files | Easy | Solution |
938 | Range Sum of BST | Easy | Solution |
939 | Minimum Area Rectangle | Medium | Solution |
940 | Distinct Subsequences II | Hard | Solution |
941 | Valid Mountain Array | Easy | Solution |
942 | DI String Match | Easy | Solution |
944 | Delete Columns to Make Sorted | Easy | Solution |
945 | Minimum Increment to Make Array Unique | Medium | Solution |
946 | Validate Stack Sequences | Medium | Solution |
947 | Most Stones Removed with Same Row or Column | Medium | Solution |
948 | Bag of Tokens | Medium | Solution |
949 | Largest Time for Given Digits | Easy | Solution |
950 | Reveal Cards In Increasing Order | Medium | Solution |
951 | Flip Equivalent Binary Trees | Medium | Solution |
952 | Largest Component Size by Common Factor | Hard | Solution |
953 | Verifying an Alien Dictionary | Easy | Solution |
954 | Array of Doubled Pairs | Medium | Solution |
955 | Delete Columns to Make Sorted II | Medium | Solution |
956 | Tallest Billboard | Hard | Solution |
957 | Prison Cells After N Days | Medium | Solution |
958 | Check Completeness of a Binary Tree | Medium | Solution |
959 | Regions Cut By Slashes | Medium | Solution |
961 | N-Repeated Element in Size 2N Array | Easy | Solution |
962 | Maximum Width Ramp | Medium | Solution |
968 | Binary Tree Cameras | Hard | Solution |
969 | Pancake Sorting | Medium | Solution |
970 | Powerful Integers | Easy | Solution |
971 | Flip Binary Tree To Match Preorder Traversal | Medium | Solution |
973 | K Closest Points to Origin | Easy | Solution |
977 | Squares of a Sorted Array | Easy | Solution |
979 | Distribute Coins in Binary Tree | Medium | Solution |
980 | Unique Paths III | Hard | Solution |
985 | Sum of Even Numbers After Queries | Easy | Solution |
986 | Interval List Intersections | Medium | Solution |
998 | Maximum Binary Tree II | Medium | Solution |
999 | Available Captures for Rook | Easy | Solution |
1002 | Find Common Characters | Easy | Solution |
1004 | Max Consecutive Ones III | Medium | Solution |
1008 | Construct Binary Search Tree from Preorder Traversal | Medium | Solution |
1011 | Capacity To Ship Packages Within D Days | Medium | Solution |
1012 | Complement of Base 10 Integer | Easy | Solution |
1013 | Pairs of Songs With Total Durations Divisible by 60 | Easy | Solution |
1014 | Best Sightseeing Pair | Medium | Solution |
1016 | Binary String With Substrings Representing 1 To N | Medium | Solution |
1019 | Next Greater Node In Linked List | Medium | Solution |
1021 | Remove Outermost Parentheses | Easy | Solution |
1022 | Sum of Root To Leaf Binary Numbers | Easy | Solution |
1025 | Divisor Game | Easy | Solution |
1028 | Recover a Tree From Preorder Traversal | Hard | Solution |
1030 | Matrix Cells in Distance Order | Easy | Solution |
1031 | Maximum Sum of Two Non-Overlapping Subarrays | Medium | Solution |
1037 | Valid Boomerang | Easy | Solution |
1038 | Binary Search Tree to Greater Sum Tree | Medium | Solution |
1039 | Minimum Score Triangulation of Polygon | Medium | Solution |
1071 | Greatest Common Divisor of Strings | Easy | Solution |
1072 | Flip Columns For Maximum Number of Equal Rows | Medium | Solution |
1073 | Adding Two Negabinary Numbers | Medium | Solution |
1074 | Number of Submatrices That Sum to Target | Hard | Solution |
5083 | Occurrences After Bigram | Easy | Solution |
5084 | Insufficient Nodes in Root to Leaf Paths | Medium | Solution |
5086 | Smallest Subsequence of Distinct Characters | Medium | Solution |
5087 | Letter Tile Possibilities | Medium | Solution |
All rights reserved by github.com/lzl124631x. Contact me if you want to redistribute the code. No commercial use.