Giter VIP home page Giter VIP logo

leetcode's Introduction

LeetCode

Author: github.com/lzl124631x

My C++ Code for LeetCode OJ.

Please give this repo a โญ if it inspires you. Thanks. ๐Ÿ˜Š

๐Ÿ˜ฉ Hate manually copy & pasting the example testcases when solving LeetCode problems?
๐Ÿ‘‰ Try my LeetCode Testcase Extractor

# Title Difficulty Solution
1 Two Sum Easy Solution
2 Add Two Numbers Medium Solution
3 Longest Substring Without Repeating Characters Medium Solution
4 Median of Two Sorted Arrays Hard Solution
5 Longest Palindromic Substring Medium Solution
6 ZigZag Conversion Medium Solution
7 Reverse Integer Easy Solution
8 String to Integer (atoi) Medium Solution
9 Palindrome Number Easy Solution
10 Regular Expression Matching Hard Solution
11 Container With Most Water Medium Solution
12 Integer to Roman Solution
13 Roman to Integer Solution
14 Longest Common Prefix Solution
15 3Sum Medium Solution
16 3Sum Closest Medium Solution
17 Letter Combinations of a Phone Number Medium Solution
18 4Sum Solution
19 Remove Nth Node From End of List Solution
20 Valid Parentheses 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 Solution
25 Reverse Nodes in k-Group Solution
26 Remove Duplicates from Sorted Array Solution
27 Remove Element Solution
28 Implement strStr() Easy Solution
29 Divide Two Integers Medium Solution
30 Substring with Concatenation of All Words Solution
31 Next Permutation Medium Solution
32 Longest Valid Parentheses Hard Solution
33 Search in Rotated Sorted Array Medium Solution
34 Search for a Range Solution
35 Search Insert Position Easy Solution
36 Valid Sudoku Solution
38 Count and Say Solution
39 Combination Sum Medium Solution
40 Combination Sum II Medium Solution
41 First Missing Positive Hard Solution
42 Trapping Rain Water Hard Solution
43 Multiply Strings Solution
44 Wildcard Matching Hard Solution
45 Jump Game II Hard Solution
46 Permutations Medium Solution
47 Permutations II Medium Solution
48 Rotate Image Solution
49 Group Anagrams Medium Solution
50 Pow(x, n) Medium Solution
53 Maximum Subarray Easy Solution
54 Spiral Matrix Medium Solution
55 Jump Game Medium Solution
58 Length of Last Word Solution
59 Spiral Matrix II Solution
60 Permutation Sequence Medium Solution
61 Rotate List Solution
62 Unique Paths Medium Solution
63 Unique Paths II Medium Solution
64 Minimum Path Sum Medium Solution
65 Valid Number Hard Solution
66 Plus One Easy Solution
67 Add Binary Easy Solution
69 Sqrt(x) Solution
70 Climbing Stairs Easy Solution
71 Simplify Path Solution
72 Edit Distance Hard Solution
74 Search a 2D Matrix 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 Solution
81 Search in Rotated Sorted Array II Medium Solution
82 Remove Duplicates from Sorted List II Solution
83 Remove Duplicates from Sorted List Solution
84 Largest Rectangle in Histogram Hard Solution
85 Maximal Rectangle Hard Solution
86 Partition List Medium Solution
87 Scramble String Hard Solution
88 Merge Sorted Array Solution
89 Gray Code Medium Solution
90 Subsets II Medium Solution
91 Decode Ways Medium Solution
92 Reverse Linked List II Solution
93 Restore IP Addresses Solution
94 Binary Tree Inorder Traversal Medium Solution
95 Unique Binary Search Trees II Medium Solution
96 Unique Binary Search Trees Medium Solution
97 Interleaving String Hard Solution
98 Validate Binary Search Tree Medium Solution
99 Recover Binary Search Tree Hard Solution
100 Same Tree Easy Solution
101 Symmetric Tree Solution
102 Binary Tree Level Order Traversal Medium 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 Solution
107 Binary Tree Level Order Traversal II Easy Solution
108 Convert Sorted Array to Binary Search Tree Solution
109 Convert Sorted List to Binary Search Tree Solution
110 Balanced Binary Tree Solution
111 Minimum Depth of Binary Tree Solution
112 Path Sum Solution
113 Path Sum II Solution
114 Flatten Binary Tree to Linked List Solution
115 Distinct Subsequences Hard Solution
116 Populating Next Right Pointers in Each Node Solution
117 Populating Next Right Pointers in Each Node II 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 Easy 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 Solution
127 Word Ladder Solution
128 Longest Consecutive Sequence Hard Solution
129 Sum Root to Leaf Numbers Medium Solution
130 Surrounded Regions Medium Solution
131 Palindrome Partitioning 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 Solution
139 Word Break Medium Solution
140 Word Break II Hard Solution
141 Linked List Cycle Solution
142 Linked List Cycle II 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 Solution
148 Sort List Solution
149 Max Points on a Line Hard Solution
150 Evaluate Reverse Polish Notation 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
155 Min Stack Easy 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
162 Find Peak Element Medium Solution
164 Maximum Gap Solution
166 Fraction to Recurring Decimal Solution
167 Two Sum II - Input array is sorted Solution
169 Majority Element Easy Solution
171 Excel Sheet Column Number 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
200 Number of Islands Medium Solution
201 Bitwise AND of Numbers Range Medium Solution
202 Happy Number Easy Solution
203 Remove Linked List Elements Easy Solution
204 Count Primes Solution
206 Reverse Linked List Easy Solution
207 Course Schedule Medium Solution
208 Implement Trie (Prefix Tree) Medium Solution
209 Minimum Size Subarray Sum 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 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 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 Solution
230 Kth Smallest Element in a BST Medium Solution
231 Power of Two Easy Solution
232 Implement Queue using Stacks Easy Solution
234 Palindrome Linked List Easy Solution
237 Delete Node in a Linked List Easy Solution
238 Product of Array Except Self Medium Solution
239 Sliding Window Maximum Hard Solution
240 Search a 2D Matrix II 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
258 Add Digits Easy Solution
259 3Sum Smaller Medium Solution
260 Single Number III Medium Solution
261 Graph Valid Tree Medium Solution
263 Ugly Number Solution
264 Ugly Number II Medium Solution
266 Palindrome Permutation Easy Solution
268 Missing Number Easy Solution
270 Closest Binary Search Tree Value Easy Solution
271 Encode and Decode Strings Medium Solution
274 H-Index Medium Solution
275 H-Index II 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
287 Find the Duplicate Number Medium Solution
289 Game of Life Medium Solution
293 Flip Game Easy Solution
295 Find Median from Data Stream Hard Solution
297 Serialize and Deserialize Binary Tree Hard Solution
298 Binary Tree Longest Consecutive Sequence Medium Solution
299 Bulls and Cows Solution
300 Longest Increasing Subsequence Medium Solution
301 Remove Invalid Parentheses Hard Solution
303 Range Sum Query - Immutable Solution
304 Range Sum Query 2D - Immutable Solution
307 Range Sum Query - Mutable Medium Solution
309 Best Time to Buy and Sell Stock with Cooldown Medium Solution
310 Minimum Height Trees Medium Solution
312 Burst Balloons Hard Solution
313 Super Ugly Number Solution
315 Count of Smaller Numbers After Self Solution
316 Remove Duplicate Letters Hard Solution
320 Generalized Abbreviation Medium Solution
321 Create Maximum Number Hard Solution
322 Coin Change Solution
324 Wiggle Sort II Solution
327 Count of Range Sum Solution
328 Odd Even Linked List Medium Solution
329 Longest Increasing Path in a Matrix Hard Solution
330 Patching Array Solution
331 Verify Preorder Serialization of a Binary Tree Solution
332 Reconstruct Itinerary Medium Solution
333 Largest BST Subtree Medium Solution
334 Increasing Triplet Subsequence Solution
335 Self Crossing 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
345 Reverse Vowels of a String Easy Solution
346 Moving Average from Data Stream Easy Solution
347 Top K Frequent Elements Medium Solution
348 Design Tic-Tac-Toe Medium Solution
349 Intersection of Two Arrays Solution
350 Intersection of Two Arrays II Solution
352 Data Stream as Disjoint Intervals Solution
354 Russian Doll Envelopes Solution
355 Design Twitter Medium Solution
357 Count Numbers with Unique Digits 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 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
372 Super Pow Solution
373 Find K Pairs with Smallest Sums Solution
374 Guess Number Higher or Lower 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 Solution
379 Design Phone Directory Medium Solution
380 Insert Delete GetRandom O(1) Medium Solution
381 Insert Delete GetRandom O(1) - Duplicates allowed Solution
382 Linked List Random Node Solution
383 Ransom Note Easy Solution
384 Shuffle an Array 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 Solution
390 Elimination Game Solution
391 Perfect Rectangle Solution
392 Is Subsequence Easy Solution
393 UTF-8 Validation Solution
394 Decode String Solution
395 Longest Substring with At Least K Repeating Characters Solution
396 Rotate Function Medium Solution
397 Integer Replacement Solution
398 Random Pick Index Solution
399 Evaluate Division Solution
400 Nth Digit Medium Solution
401 Binary Watch Solution
402 Remove K Digits Medium Solution
403 Frog Jump Solution
404 Sum of Left Leaves Solution
405 Convert a Number to Hexadecimal Solution
406 Queue Reconstruction by Height Medium Solution
407 Trapping Rain Water II Solution
408 Valid Word Abbreviation Easy Solution
409 Longest Palindrome Easy Solution
410 Split Array Largest Sum Hard Solution
412 Fizz Buzz Easy Solution
413 Arithmetic Slices Medium Solution
414 Third Maximum Number Solution
415 Add Strings Easy Solution
416 Partition Equal Subset Sum Medium Solution
417 Pacific Atlantic Water Flow Solution
419 Battleships in a Board Solution
420 Strong Password Checker Solution
421 Maximum XOR of Two Numbers in an Array Solution
422 Valid Word Square Easy Solution
423 Reconstruct Original Digits from English Solution
424 Longest Repeating Character Replacement Solution
427 Construct Quad Tree Easy Solution
429 N-ary Tree Level Order Traversal Easy Solution
430 Flatten a Multilevel Doubly Linked List Medium Solution
432 All O`one Data Structure Solution
434 Number of Segments in a String Solution
435 Non-overlapping Intervals Medium Solution
436 Find Right Interval Solution
437 Path Sum III Medium Solution
438 Find All Anagrams in a String Medium Solution
440 K-th Smallest in Lexicographical Order 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 Solution
446 Arithmetic Slices II - Subsequence Hard Solution
447 Number of Boomerangs Solution
448 Find All Numbers Disappeared in an Array Solution
449 Serialize and Deserialize BST Solution
450 Delete Node in a BST Medium Solution
451 Sort Characters By Frequency Medium Solution
452 Minimum Number of Arrows to Burst Balloons Solution
453 Minimum Moves to Equal Array Elements Solution
454 4Sum II Medium Solution
455 Assign Cookies Solution
456 132 Pattern Medium Solution
459 Repeated Substring Pattern Solution
460 LFU Cache Solution
461 Hamming Distance Easy Solution
462 Minimum Moves to Equal Array Elements II Solution
463 Island Perimeter Easy Solution
464 Can I Win Solution
466 Count The Repetitions Hard Solution
467 Unique Substrings in Wraparound String Solution
468 Validate IP Address Medium Solution
471 Encode String with Shortest Length Hard Solution
472 Concatenated Words Hard Solution
473 Matchsticks to Square Solution
474 Ones and Zeroes Medium Solution
475 Heaters Solution
476 Number Complement Easy Solution
477 Total Hamming Distance Solution
478 Generate Random Point in a Circle Medium Solution
480 Sliding Window Median Solution
481 Magical String Solution
482 License Key Formatting Solution
483 Smallest Good Base Hard Solution
485 Max Consecutive Ones Solution
486 Predict the Winner Medium Solution
487 Max Consecutive Ones II Solution
488 Zuma Game Solution
489 Robot Room Cleaner Hard Solution
490 The Maze Medium Solution
491 Increasing Subsequences Medium Solution
492 Construct the Rectangle Solution
494 Target Sum Medium Solution
495 Teemo Attacking Solution
496 Next Greater Element I Easy Solution
498 Diagonal Traverse Solution
500 Keyboard Row Solution
501 Find Mode in Binary Search Tree Solution
502 IPO Solution
503 Next Greater Element II Medium Solution
504 Base 7 Solution
506 Relative Ranks Solution
507 Perfect Number Easy Solution
508 Most Frequent Subtree Sum Solution
509 Fibonacci Number Easy Solution
513 Find Bottom Left Tree Value Solution
514 Freedom Trail Hard Solution
515 Find Largest Value in Each Tree Row 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 Solution
525 Contiguous Array Medium Solution
526 Beautiful Arrangement Medium Solution
528 Random Pick with Weight Medium Solution
529 Minesweeper Solution
530 Minimum Absolute Difference in BST Solution
532 K-diff Pairs in an Array Easy Solution
535 Encode and Decode TinyURL Solution
536 Construct Binary Tree from String Solution
537 Complex Number Multiplication Medium Solution
538 Convert BST to Greater Tree Solution
539 Minimum Time Difference Solution
540 Single Element in a Sorted Array Medium Solution
541 Reverse String II Solution
542 01 Matrix Solution
543 Diameter of Binary Tree Easy Solution
544 Output Contest Matches Medium Solution
546 Remove Boxes Hard Solution
547 Friend Circles Medium Solution
549 Binary Tree Longest Consecutive Sequence II Solution
551 Student Attendance Record I Easy Solution
552 Student Attendance Record II Hard 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 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 Solution
562 Longest Line of Consecutive One in Matrix Solution
563 Binary Tree Tilt 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
576 Out of Boundary Paths Medium 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
593 Valid Square Medium 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
603 Consecutive Available Seats Easy 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
617 Merge Two Binary Trees Easy Solution
620 Not Boring Movies Easy Solution
621 Task Scheduler Medium Solution
622 Design Circular Queue Medium Solution
627 Swap Salary Easy Solution
628 Maximum Product of Three Numbers Easy Solution
629 K Inverse Pairs Array Hard Solution
636 Exclusive Time of Functions Medium Solution
637 Average of Levels in Binary Tree Easy Solution
638 Shopping Offers Medium Solution
639 Decode Ways II Hard Solution
640 Solve the Equation Medium Solution
643 Maximum Average Subarray I Easy Solution
645 Set Mismatch Easy Solution
647 Palindromic Substrings Medium Solution
648 Replace Words Medium Solution
650 2 Keys Keyboard 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
664 Strange Printer Hard Solution
666 Path Sum IV Medium Solution
668 Kth Smallest Number in Multiplication Table Hard Solution
669 Trim a Binary Search Tree Easy Solution
670 Maximum Swap Medium Solution
673 Number of Longest Increasing Subsequence 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
687 Longest Univalue Path Easy Solution
688 Knight Probability in Chessboard Medium Solution
690 Employee Importance Easy Solution
691 Stickers to Spell Word Hard 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
699 Falling Squares Hard 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
714 Best Time to Buy and Sell Stock with Transaction Fee Medium Solution
717 1-bit and 2-bit Characters Easy Solution
718 Maximum Length of Repeated Subarray Medium Solution
719 Find K-th Smallest Pair Distance Hard Solution
720 Longest Word in Dictionary Easy Solution
721 Accounts Merge Medium Solution
723 Candy Crush Medium Solution
724 Find Pivot Index Easy Solution
725 Split Linked List in Parts Medium Solution
726 Number of Atoms Hard Solution
728 Self Dividing Numbers Easy Solution
730 Count Different Palindromic Subsequences Hard Solution
733 Flood Fill Easy Solution
735 Asteroid Collision Medium Solution
739 Daily Temperatures Medium Solution
740 Delete and Earn Medium Solution
743 Network Delay Time 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
751 IP to CIDR Hard Solution
752 Open the Lock Medium Solution
753 Cracking the Safe Hard 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
765 Couples Holding Hands Hard Solution
766 Toeplitz Matrix Easy Solution
767 Reorganize String Medium Solution
768 Max Chunks To Make Sorted II Hard Solution
769 Max Chunks To Make Sorted Medium Solution
770 Basic Calculator IV Hard Solution
771 Jewels and Stones Easy Solution
775 Global and Local Inversions Medium Solution
777 Swap Adjacent in LR String Medium Solution
783 Minimum Distance Between BST Nodes Medium Solution
784 Letter Case Permutation Easy Solution
785 Is Graph Bipartite? Medium Solution
787 Cheapest Flights Within K Stops Medium Solution
788 Rotated Digits Easy Solution
791 Custom Sort String Medium Solution
793 Preimage Size of Factorial Zeroes Function Hard Solution
794 Valid Tic-Tac-Toe State Medium Solution
795 Number of Subarrays with Bounded Maximum Medium Solution
796 Rotate String Easy Solution
797 All Paths From Source to Target Medium Solution
798 Smallest Rotation with Highest Score Solution
800 Similar RGB Color Easy Solution
801 Minimum Swaps To Make Sequences Increasing Medium Solution
802 Find Eventual Safe States Medium Solution
804 Unique Morse Code Words Easy Solution
805 Split Array With Same Average Hard 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
813 Largest Sum of Averages Medium Solution
814 Binary Tree Pruning Medium 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
827 Making A Large Island Hard 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
837 New 21 Game Medium Solution
840 Magic Squares In Grid Easy Solution
841 Keys and Rooms Medium Solution
843 Guess the Word Hard Solution
844 Backspace String Compare Easy Solution
846 Hand of Straights Medium Solution
852 Peak Index in a Mountain Array Easy Solution
856 Score of Parentheses Medium Solution
857 Minimum Cost to Hire K Workers Hard Solution
859 Buddy Strings Easy 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
886 Possible Bipartition 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
891 Sum of Subsequence Widths 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
896 Monotonic Array Easy Solution
897 Increasing Order Search Tree Easy Solution
899 Orderly Queue Hard Solution
901 Online Stock Span Medium Solution
902 Numbers At Most N Given Digit Set Hard Solution
903 Valid Permutations for DI Sequence 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
918 Maximum Sum Circular Subarray Medium 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
923 3Sum With Multiplicity Medium 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
930 Binary Subarrays With Sum Medium Solution
931 Minimum Falling Path Sum Medium Solution
932 Beautiful Array 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
943 Find the Shortest Superstring Hard 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
978 Longest Turbulent Subarray Medium Solution
979 Distribute Coins in Binary Tree Medium Solution
980 Unique Paths III Hard Solution
983 Minimum Cost For Tickets Medium Solution
984 String Without AAA or BBB Medium Solution
985 Sum of Even Numbers After Queries Easy Solution
986 Interval List Intersections Medium Solution
987 Vertical Order Traversal of a Binary Tree Medium Solution
990 Satisfiability of Equality Equations Medium Solution
993 Cousins in Binary Tree Easy Solution
994 Rotting Oranges Medium Solution
997 Find the Town Judge Easy Solution
998 Maximum Binary Tree II Medium Solution
999 Available Captures for Rook Easy Solution
1000 Minimum Cost to Merge Stones Hard 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
1020 Number of Enclaves Medium Solution
1021 Remove Outermost Parentheses Easy Solution
1022 Sum of Root To Leaf Binary Numbers Easy Solution
1025 Divisor Game Easy Solution
1027 Longest Arithmetic Sequence Medium Solution
1028 Recover a Tree From Preorder Traversal Hard Solution
1029 Two City Scheduling Easy Solution
1030 Matrix Cells in Distance Order Easy Solution
1031 Maximum Sum of Two Non-Overlapping Subarrays Medium Solution
1034 Coloring A Border Medium Solution
1035 Uncrossed Lines 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
1042 Flower Planting With No Adjacent Easy Solution
1043 Partition Array for Maximum Sum Medium Solution
1044 Longest Duplicate Substring Hard Solution
1046 Last Stone Weight Easy Solution
1047 Remove All Adjacent Duplicates In String Easy Solution
1053 Previous Permutation With One Swap Medium Solution
1054 Distant Barcodes 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
1078 Occurrences After Bigram Easy Solution
1079 Letter Tile Possibilities Medium Solution
1080 Insufficient Nodes in Root to Leaf Paths Medium Solution
1081 Smallest Subsequence of Distinct Characters Medium Solution
1092 Shortest Common Supersequence Hard Solution
1096 Brace Expansion II Hard Solution
1104 Path In Zigzag Labelled Binary Tree Medium Solution
1105 Filling Bookcase Shelves Medium Solution
1106 Parsing A Boolean Expression Hard Solution
1108 Defanging an IP Address Easy Solution
1111 Maximum Nesting Depth of Two Valid Parentheses Strings Medium Solution
1125 Smallest Sufficient Team Hard Solution
1130 Minimum Cost Tree From Leaf Values Medium Solution
1140 Stone Game II Medium Solution
1143 Longest Common Subsequence Medium Solution
1146 Snapshot Array Medium Solution
1154 Day of the Year Easy Solution
1160 Find Words That Can Be Formed by Characters Easy Solution
1161 Maximum Level Sum of a Binary Tree Medium Solution
1162 As Far from Land as Possible Medium Solution
1163 Last Substring in Lexicographical Order Hard Solution
1169 Invalid Transactions Medium Solution
1184 Distance Between Bus Stops Easy Solution
1185 Day of the Week Easy Solution
1186 Maximum Subarray Sum with One Deletion Medium Solution
1187 Make Array Strictly Increasing Hard Solution
1189 Maximum Number of Balloons Easy Solution
1190 Reverse Substrings Between Each Pair of Parentheses Medium Solution
1203 Sort Items by Groups Respecting Dependencies Hard Solution
1207 Unique Number of Occurrences Easy Solution
1209 Remove All Adjacent Duplicates in String II Medium Solution
1220 Count Vowels Permutation Hard Solution
1223 Dice Roll Simulation Medium Solution
1232 Check If It Is a Straight Line Easy Solution
1235 Maximum Profit in Job Scheduling Hard Solution
1252 Cells with Odd Values in a Matrix Easy Solution
1266 Minimum Time Visiting All Points Easy Solution
1267 Count Servers that Communicate Medium Solution
1268 Search Suggestions System Medium Solution
1269 Number of Ways to Stay in the Same Place After Some Steps Hard Solution
1277 Count Square Submatrices with All Ones Medium Solution
1278 Palindrome Partitioning III Hard Solution
1282 Group the People Given the Group Size They Belong To Medium Solution
1286 Iterator for Combination Medium Solution
1288 Remove Covered Intervals Medium Solution
1289 Minimum Falling Path Sum II Hard Solution
1290 Convert Binary Number in a Linked List to Integer Easy Solution
1293 Shortest Path in a Grid with Obstacles Elimination Hard Solution
1295 Find Numbers with Even Number of Digits Easy Solution
1300 Sum of Mutated Array Closest to Target Medium Solution
1301 Number of Paths with Max Score Hard Solution
1312 Minimum Insertion Steps to Make a String Palindrome Hard Solution
1313 Decompress Run-Length Encoded List Easy Solution
1315 Sum of Nodes with Even-Valued Grandparent Medium Solution
1316 Distinct Echo Substrings Hard Solution
1319 Number of Operations to Make Network Connected Medium Solution
1320 Minimum Distance to Type a Word Using Two Fingers Hard Solution
1323 Maximum 69 Number Easy Solution
1324 Print Words Vertically Medium Solution
1325 Delete Leaves With a Given Value Medium Solution
1326 Minimum Number of Taps to Open to Water a Garden Hard Solution
1328 Break a Palindrome Medium Solution
1329 Sort the Matrix Diagonally Medium Solution
1330 Reverse Subarray To Maximize Array Value Hard Solution
1331 Rank Transform of an Array Easy Solution
1332 Remove Palindromic Subsequences Easy Solution
1333 Filter Restaurants by Vegan-Friendly, Price and Distance Medium Solution
1334 Find the City With the Smallest Number of Neighbors at a Threshold Distance Medium Solution
1335 Minimum Difficulty of a Job Schedule Hard Solution
1338 Reduce Array Size to The Half Medium Solution
1339 Maximum Product of Splitted Binary Tree Medium Solution
1340 Jump Game V Hard Solution
1341 The K Weakest Rows in a Matrix Easy Solution
1342 Number of Steps to Reduce a Number to Zero Easy Solution
1343 Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold Medium Solution
1344 Angle Between Hands of a Clock Medium Solution
1345 Jump Game IV Hard Solution
1346 Check If N and Its Double Exist Easy Solution
1347 Minimum Number of Steps to Make Two Strings Anagram Medium Solution
1348 Tweet Counts Per Frequency Medium Solution
1349 Maximum Students Taking Exam Hard Solution
1351 Count Negative Numbers in a Sorted Matrix Easy Solution
1352 Product of the Last K Numbers Medium Solution
1353 Maximum Number of Events That Can Be Attended Medium Solution
1354 Construct Target Array With Multiple Sums Hard Solution
1356 Sort Integers by The Number of 1 Bits Easy Solution
1357 Apply Discount Every n Orders Medium Solution
1358 Number of Substrings Containing All Three Characters Medium Solution
1359 Count All Valid Pickup and Delivery Options Hard Solution
1360 Number of Days Between Two Dates Easy Solution
1361 Validate Binary Tree Nodes Medium Solution
1367 Linked List in Binary Tree Medium Solution
1370 Increasing Decreasing String Easy Solution
1371 Find the Longest Substring Containing Vowels in Even Counts Medium Solution
1372 Longest ZigZag Path in a Binary Tree Medium Solution
1373 Maximum Sum BST in Binary Tree Hard Solution
1374 Generate a String With Characters That Have Odd Counts Easy Solution
1375 Bulb Switcher III Medium Solution
1376 Time Needed to Inform All Employees Medium Solution
1377 Frog Position After T Seconds Hard Solution
1380 Lucky Numbers in a Matrix Easy Solution
1381 Design a Stack With Increment Operation Medium Solution
1382 Balance a Binary Search Tree Medium Solution
1383 Maximum Performance of a Team Hard Solution
1385 Find the Distance Value Between Two Arrays Easy Solution
1386 Cinema Seat Allocation Medium Solution
1387 Sort Integers by The Power Value Medium Solution
1388 Pizza With 3n Slices Hard Solution
1389 Create Target Array in the Given Order Easy Solution
1390 Four Divisors Medium Solution
1391 Check if There is a Valid Path in a Grid Medium Solution
1392 Longest Happy Prefix Hard Solution
1397 Find All Good Strings Hard Solution
1399 Count Largest Group Easy Solution
1400 Construct K Palindrome Strings Medium Solution
1401 Circle and Rectangle Overlapping Medium Solution
1402 Reducing Dishes Hard Solution
1403 Minimum Subsequence in Non-Increasing Order Easy Solution
1404 Number of Steps to Reduce a Number in Binary Representation to One Medium Solution
1405 Longest Happy String Medium Solution
1406 Stone Game III Hard Solution
1408 String Matching in an Array Easy Solution
1409 Queries on a Permutation With Key Medium Solution
1410 HTML Entity Parser Medium Solution
1411 Number of Ways to Paint N ร— 3 Grid Hard Solution
1413 Minimum Value to Get Positive Step by Step Sum Easy Solution
1414 Find the Minimum Number of Fibonacci Numbers Whose Sum Is K Medium Solution
1415 The k-th Lexicographical String of All Happy Strings of Length n Medium Solution
1416 Restore The Array Hard Solution
1419 Minimum Number of Frogs Croaking Medium Solution
1420 Build Array Where You Can Find The Maximum Exactly K Comparisons Hard Solution
1422 Maximum Score After Splitting a String Easy Solution
1423 Maximum Points You Can Obtain from Cards Medium Solution
1424 Diagonal Traverse II Medium Solution
1425 Constrained Subsequence Sum Hard Solution
1428 Leftmost Column with at Least a One Medium Solution
1429 First Unique Number Medium Solution
1430 Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree Medium Solution
1434 Number of Ways to Wear Different Hats to Each Other Hard Solution
1436 Destination City Easy Solution
1437 Check If All 1's Are at Least Length K Places Away Medium Solution
1438 Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit Medium Solution
1439 Find the Kth Smallest Sum of a Matrix With Sorted Rows Hard Solution
1441 Build an Array With Stack Operations Solution
1443 Minimum Time to Collect All Apples in a Tree Medium Solution
1444 Number of Ways of Cutting a Pizza Hard Solution
1446 Consecutive Characters Easy Solution
1447 Simplified Fractions Medium Solution
1448 Count Good Nodes in Binary Tree Medium Solution
1449 Form Largest Integer With Digits That Add up to Target Hard Solution
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence Easy Solution
1456 Maximum Number of Vowels in a Substring of Given Length Medium Solution
1457 Pseudo-Palindromic Paths in a Binary Tree Medium Solution
1458 Max Dot Product of Two Subsequences Hard Solution
1460 Make Two Arrays Equal by Reversing Sub-arrays Easy Solution
1461 Check If a String Contains All Binary Codes of Size K Medium Solution
1462 Course Schedule IV Medium Solution
1463 Cherry Pickup II Hard Solution
1464 Maximum Product of Two Elements in an Array Easy Solution
1467 Probability of a Two Boxes Having The Same Number of Distinct Balls Hard Solution
1470 Shuffle the Array Easy Solution
1471 The k Strongest Values in an Array Medium Solution
1472 Design Browser History Medium Solution
1473 Paint House III Hard Solution
1475 Final Prices With a Special Discount in a Shop Easy Solution
1476 Subrectangle Queries Medium Solution
1477 Find Two Non-overlapping Sub-arrays Each With Target Sum Solution
1478 Allocate Mailboxes Hard Solution
1480 Running Sum of 1d Array Easy Solution
1481 Least Number of Unique Integers after K Removals Medium Solution
1482 Minimum Number of Days to Make m Bouquets Medium Solution
1483 Kth Ancestor of a Tree Node Hard Solution
1486 XOR Operation in an Array Easy Solution
1487 Making File Names Unique Medium Solution
1488 Avoid Flood in The City Medium Solution
1491 Average Salary Excluding the Minimum and Maximum Salary Easy Solution
1492 The kth Factor of n Medium Solution
1493 Longest Subarray of 1's After Deleting One Element Medium Solution
1494 Parallel Courses II Hard Solution
1496 Path Crossing Easy Solution
1497 Check If Array Pairs Are Divisible by k Medium Solution
1498 Number of Subsequences That Satisfy the Given Sum Condition Medium Solution
1499 Max Value of Equation Hard Solution
1502 Can Make Arithmetic Progression From Sequence Easy Solution
1503 Last Moment Before All Ants Fall Out of a Plank Medium Solution
1504 Count Submatrices With All Ones Medium Solution
1505 Minimum Possible Integer After at Most K Adjacent Swaps On Digits Hard Solution
1507 Reformat Date Easy Solution
1508 Range Sum of Sorted Subarray Sums Medium Solution
1509 Minimum Difference Between Largest and Smallest Value in Three Moves Medium Solution
1510 Stone Game IV Hard Solution
1512 Number of Good Pairs Easy Solution
1513 Number of Substrings With Only 1s Medium Solution
1514 Path with Maximum Probability Medium Solution
1515 Best Position for a Service Centre Hard Solution
1518 Water Bottles Easy Solution
1519 Number of Nodes in the Sub-Tree With the Same Label Medium Solution
1520 Maximum Number of Non-Overlapping Substrings Medium Solution
1521 Find a Value of a Mysterious Function Closest to Target Hard Solution
1523 Count Odd Numbers in an Interval Range Easy Solution
1524 Number of Sub-arrays With Odd Sum Medium Solution
1525 Number of Good Ways to Split a String Medium Solution
1526 Minimum Number of Increments on Subarrays to Form a Target Array Hard Solution
1531 String Compression II Hard Solution
1534 Count Good Triplets Easy Solution
1535 Find the Winner of an Array Game Medium Solution
1536 Minimum Swaps to Arrange a Binary Grid Medium Solution
1537 Get the Maximum Score Hard Solution
1539 Kth Missing Positive Number Easy Solution
1542 Find Longest Awesome Substring Hard Solution
1544 Make The String Great Easy Solution
1545 Find Kth Bit in Nth Binary String Medium Solution
1546 Maximum Number of Non-Overlapping Subarrays With Sum Equals Target Medium Solution
1547 Minimum Cost to Cut a Stick Hard Solution

License

All rights reserved by github.com/lzl124631x. Contact me if you want to redistribute the code. No commercial use.

leetcode's People

Contributors

lzl124631x avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.