Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
/ LeetCode Public template

Documenting my LeetCode journey one problem at a time. Feel free to use this repository's public template

License

Notifications You must be signed in to change notification settings

Suvraneel/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

Documenting my LeetCode journey one problem at a time


Leetcode Problem Problem Statement C++ Solution
1 Two Sum Solution
2 Add Two Numbers Solution
7 Reverse Integer Solution
8 String to Integer Atoi Solution
9 Palindrome Number Solution
11 Container With most Water Solution
12 Integer to Roman Solution
13 Roman to Integer Solution
16 3sum Closest Solution
17 Letter Combinations of a Phone Number Solution
19 Remove Nth Node from End of List Solution
21 Merge Two Sorted Lists Solution
23 Merge K Sorted Lists Solution
24 Swap Nodes in Pairs Solution
26 Remove Duplicates from Sorted Array Solution
28 Find the Index of the First Occurrence in a String Solution
30 Substring With Concatenation of all Words Solution
32 Longest Valid Parentheses Solution
33 Search in Rotated Sorted Array Solution
35 Search Insert Position Solution
36 Valid Sudoku Solution
38 Count and Say Solution
39 Combination Sum Solution
40 Combination Sum II Solution
42 Trapping Rain Water Solution
48 Rotate Image Solution
49 Group Anagrams Solution
53 Maximum Subarray Solution
56 Merge Intervals Solution
62 Unique Paths Solution
67 Add Binary Solution
68 Text Justification Solution
69 Sqrtx Solution
70 Climbing Stairs Solution
72 Edit Distance Solution
74 Search a 2d Matrix Solution
75 Sort Colors Solution
76 Minimum Window Substring Solution
77 Combinations Solution
78 Subsets Solution
79 Word Search Solution
80 Remove Duplicates from Sorted Array II Solution
84 Largest Rectangle in Histogram Solution
88 Merge Sorted Array Solution
91 Decode Ways Solution
94 Binary Tree Inorder Traversal Solution
95 Unique Binary Search Trees II Solution
97 Interleaving String Solution
98 Validate Binary Search Tree Solution
99 Recover Binary Search Tree Solution
100 Same Tree Solution
103 Binary Tree Zigzag Level Order Traversal Solution
104 Maximum Depth of Binary Tree Solution
108 Convert Sorted Array to Binary Search Tree Solution
109 Convert Sorted List to Binary Search Tree Solution
111 Minimum Depth of Binary Tree Solution
112 Path Sum Solution
113 Path Sum II Solution
116 Populating Next Right Pointers in each Node Solution
118 Pascals Triangle Solution
119 Pascals Triangle II Solution
121 Best Time to Buy and Sell Stock Solution
125 Valid Palindrome Solution
126 Word Ladder II Solution
131 Palindrome Partitioning Solution
134 Gas Station Solution
136 Single Number Solution
137 Single Number II Solution
139 Word Break Solution
141 Linked List Cycle Solution
142 Linked List Cycle II Solution
143 Reorder List Solution
144 Binary Tree Preorder Traversal Solution
145 Binary Tree Postorder Traversal Solution
147 Insertion Sort List Solution
149 Max Points on a Line Solution
150 Evaluate Reverse Polish Notation Solution
151 Reverse Words in a String Solution
160 Intersection of Two Linked Lists Solution
173 Binary Search Tree Iterator Solution
175 Combine Two Tables Solution
179 Largest Number Solution
188 Best Time to Buy and Sell Stock IV Solution
189 Rotate Array Solution
198 House Robber Solution
200 Number of Islands Solution
203 Remove Linked List Elements Solution
209 Minimum Size Subarray Sum Solution
210 Course Schedule II Solution
212 Word Search II Solution
214 Shortest Palindrome Solution
218 The Skyline Problem Solution
219 Contains Duplicate II Solution
221 Maximal Square Solution
222 Count Complete Tree Nodes Solution
223 Rectangle Area Solution
224 Basic Calculator Solution
226 Invert Binary Tree Solution
227 Basic Calculator II Solution
230 Kth Smallest Element in a Bst Solution
234 Palindrome Linked List Solution
235 Lowest Common Ancestor of a Binary Search Tree Solution
236 Lowest Common Ancestor of a Binary Tree Solution
237 Delete Node in a Linked List Solution
238 Product of Array Except Self Solution
239 Sliding Window Maximum Solution
241 Different Ways to Add Parentheses Solution
242 Valid Anagram Solution
258 Add Digits Solution
260 Single Number III Solution
263 Ugly Number Solution
264 Ugly Number II Solution
273 Integer to English Words Solution
278 First Bad Version Solution
279 Perfect Squares Solution
287 Find the Duplicate Number Solution
290 Word Pattern Solution
295 Find Median from Data Stream Solution
300 Longest Increasing Subsequence Solution
307 Range Sum Query Mutable Solution
309 Best Time to Buy and Sell Stock With Cooldown Solution
310 Minimum Height Trees Solution
312 Burst Balloons Solution
319 Bulb Switcher Solution
326 Power of Three Solution
329 Longest Increasing Path in a Matrix Solution
330 Patching Array Solution
334 Increasing Triplet Subsequence Solution
336 Palindrome Pairs Solution
338 Counting Bits Solution
342 Power of Four Solution
344 Reverse String Solution
345 Reverse Vowels of a String Solution
349 Intersection of Two Arrays Solution
350 Intersection of Two Arrays II Solution
363 Max Sum of Rectangle no Larger than K Solution
373 Find K Pairs With Smallest Sums Solution
374 Guess Number Higher or Lower Solution
377 Combination Sum IV Solution
378 Kth Smallest Element in a Sorted Matrix Solution
380 Insert Delete Getrandom O1 Solution
382 Linked List Random Node Solution
383 Ransom Note Solution
386 Lexicographical Numbers Solution
387 First Unique Character in a String Solution
389 Find the Difference Solution
392 IS Subsequence Solution
393 Utf 8 Validation Solution
394 Decode String Solution
399 Evaluate Division Solution
402 Remove K Digits Solution
409 Longest Palindrome Solution
427 Construct Quad Tree Solution
429 N Ary Tree Level Order Traversal Solution
432 All Oone Data Structure Solution
433 Minimum Genetic Mutation Solution
438 Find all Anagrams in a String Solution
440 K Th Smallest in Lexicographical Order Solution
441 Arranging Coins Solution
443 String Compression Solution
446 Arithmetic Slices II Subsequence Solution
451 Sort Characters by Frequency Solution
452 Minimum Number of Arrows to Burst Balloons Solution
458 Poor Pigs Solution
472 Concatenated Words Solution
476 Number Complement Solution
486 Predict the Winner Solution
494 Target Sum Solution
502 IPO Solution
518 Coin Change II Solution
520 Detect Capital Solution
523 Continuous Subarray Sum Solution
525 Contiguous Array Solution
532 K Diff Pairs in an Array Solution
535 Encode and Decode Tinyurl Solution
539 Minimum Time Difference Solution
540 Single Element in a Sorted Array Solution
547 Number of Provinces Solution
557 Reverse Words in a String III Solution
560 Subarray Sum Equals K Solution
564 Find the Closest Palindrome Solution
567 Permutation in String Solution
587 Erect the Fence Solution
590 N Ary Tree Postorder Traversal Solution
592 Fraction Addition and Subtraction Solution
605 Can Place Flowers Solution
606 Construct String from Binary Tree Solution
609 Find Duplicate File in System Solution
622 Design Circular Queue Solution
623 Add One Row to Tree Solution
624 Maximum Distance in Arrays Solution
632 Smallest Range Covering Elements from K Lists Solution
633 Sum of Square Numbers Solution
637 Average of Levels in Binary Tree Solution
641 Design Circular Deque Solution
643 Maximum Average Subarray I Solution
645 Set Mismatch Solution
648 Replace Words Solution
650 2 Keys Keyboard Solution
652 Find Duplicate Subtrees Solution
653 Two Sum IV Input IS a Bst Solution
658 Find K Closest Elements Solution
659 Split Array Into Consecutive Subsequences Solution
664 Strange Printer Solution
670 Maximum Swap Solution
692 Top K Frequent Words Solution
701 Insert Into a Binary Search Tree Solution
703 Kth Largest Element in a Stream Solution
704 Binary Search Solution
705 Design Hashset Solution
712 Minimum Ascii Delete Sum for Two Strings Solution
718 Maximum Length of Repeated Subarray Solution
719 Find K Th Smallest Pair Distance Solution
725 Split Linked List in Parts Solution
726 Number of Atoms Solution
729 My Calendar I Solution
731 My Calendar II Solution
732 My Calendar III Solution
739 Daily Temperatures Solution
743 Network Delay Time Solution
763 Partition Labels Solution
766 Toeplitz Matrix Solution
771 Jewels and Stones Solution
783 Minimum Distance Between Bst Nodes Solution
787 Cheapest Flights Within K Stops Solution
790 Domino and Tromino Tiling Solution
796 Rotate String Solution
797 All Paths from Source to Target Solution
802 K Th Smallest Prime Fraction Solution
804 Unique Morse Code Words Solution
814 Binary Tree Pruning Solution
826 Most Profit Assigning Work Solution
834 Sum of Distances in Tree Solution
835 Image Overlap Solution
838 Push Dominoes Solution
840 Magic Squares in Grid Solution
841 Keys and Rooms Solution
846 Hand of Straights Solution
851 Loud and Rich Solution
858 Mirror Reflection Solution
860 Lemonade Change Solution
869 Reordered Power of 2 Solution
871 Minimum Number of Refueling Stops Solution
874 Walking Robot Simulation Solution
875 Koko Eating Bananas Solution
876 Middle of the Linked List Solution
879 Profitable Schemes Solution
884 Uncommon Words from Two Sentences Solution
885 Spiral Matrix III Solution
886 Possible Bipartition Solution
890 Find and Replace Pattern Solution
893 All Nodes Distance K in Binary Tree Solution
895 Maximum Frequency Stack Solution
897 Increasing Order Search Tree Solution
899 Orderly Queue Solution
901 Online Stock Span Solution
902 Numbers at most N Given Digit Set Solution
904 Fruit Into Baskets Solution
907 Sum of Subarray Minimums Solution
908 Middle of the Linked List Solution
909 Snakes and Ladders Solution
912 Sort an Array Solution
916 Word Subsets Solution
918 Maximum Sum Circular Subarray Solution
921 Minimum Add to Make Parentheses Valid Solution
922 Sort Array by Parity II Solution
936 Stamping the Sequence Solution
941 Valid Mountain Array Solution
944 Delete Columns to Make Sorted Solution
945 Minimum Increment to Make Array Unique Solution
947 Most Stones Removed With same Row or Column Solution
948 Bag of Tokens Solution
951 Flip Equivalent Binary Trees Solution
956 Number of Music Playlists Solution
958 Sort Array by Parity II Solution
959 Regions Cut by Slashes Solution
962 Maximum Width Ramp Solution
967 Numbers With same Consecutive Differences Solution
973 K Closest Points to Origin Solution
974 Subarray Sums Divisible by K Solution
976 Largest Perimeter Triangle Solution
980 Unique Paths III Solution
981 Time Based Key Value Store Solution
983 Minimum Cost for Tickets Solution
985 Sum of Even Numbers After Queries Solution
987 Vertical Order Traversal of a Binary Tree Solution
989 Add to Array Form of Integer Solution
990 Satisfiability of Equality Equations Solution
994 Rotting Oranges Solution
995 Minimum Number of K Consecutive Bit Flips Solution
997 Find the Town Judge Solution
1002 Find Common Characters Solution
1004 Max Consecutive Ones III Solution
1009 Complement of Base 10 Integer Solution
1010 Pairs of Songs With Total Durations Divisible by 60 Solution
1011 Capacity to Ship Packages Within D Days Solution
1015 Smallest Integer Divisible by K Solution
1022 Sum of Root to Leaf Binary Numbers Solution
1026 Maximum Difference Between Node and Ancestor Solution
1038 Binary Search Tree to Greater Sum Tree Solution
1041 Robot Bounded in Circle Solution
1047 Remove all Adjacent Duplicates in String Solution
1051 Height Checker Solution
1052 Grumpy Bookstore Owner Solution
1071 Greatest Common Divisor of Strings Solution
1094 Car Pooling Solution
1105 Filling Bookcase Shelves Solution
1106 Parsing a Boolean Expression Solution
1110 Delete Nodes and Return Forest Solution
1129 Shortest Path With Alternating Colors Solution
1137 N Th Tribonacci Number Solution
1140 Stone Game II Solution
1155 Number of Dice Rolls With Target Sum Solution
1162 As Far from Land As Possible Solution
1190 Reverse Substrings Between each Pair of Parentheses Solution
1200 Minimum Absolute Difference Solution
1202 Smallest String With Swaps Solution
1207 Unique Number of Occurrences Solution
1208 Get Equal Substrings Within Budget Solution
1233 Remove Sub Folders from the Filesystem Solution
1235 Maximum Profit in Job Scheduling Solution
1239 Maximum Length of a Concatenated String With Unique Characters Solution
1248 Count Number of Nice Subarrays Solution
1277 Count Square Submatrices With all Ones Solution
1291 Sequential Digits Solution
1293 Shortest Path in a Grid With Obstacles Elimination Solution
1304 Longest Happy String Solution
1305 All Elements in Two Binary Search Trees Solution
1310 Xor Queries of a Subarray Solution
1312 Minimum Insertion Steps to Make a String Palindrome Solution
1323 Maximum 69 Number Solution
1328 Break a Palindrome Solution
1329 Sort the Matrix Diagonally Solution
1331 Rank Transform of an Array Solution
1334 Find the City With the Smallest Number of Neighbors at a Threshold Distance Solution
1335 Minimum Difficulty of a Job Schedule Solution
1338 Reduce Array Size to the Half Solution
1345 Jump Game IV Solution
1365 How Many Numbers Are Smaller than the Current Number Solution
1367 Linked List in Binary Tree Solution
1371 Find the Longest Substring Containing Vowels in Even Counts Solution
1380 Lucky Numbers in a Matrix Solution
1381 Design a Stack With Increment Operation Solution
1382 Balance a Binary Search Tree Solution
1395 Count Number of Teams Solution
1396 Design Underground System Solution
1404 Number of Steps to Reduce a Number in Binary Representation to One Solution
1405 Longest Happy String Solution
1416 Restore the Array Solution
1418 Fair Distribution of Cookies Solution
1438 Longest Continuous Subarray With Absolute Diff Less than or Equal to Limit Solution
1443 Minimum Time to Collect all Apples in a Tree Solution
1448 Count Good Nodes in Binary Tree Solution
1457 Pseudo Palindromic Paths in a Binary Tree Solution
1460 Make Two Arrays Equal by Reversing Subarrays Solution
1463 Cherry Pickup II Solution
1482 Minimum Number of Days to Make M Bouquets Solution
1497 Check IF Array Pairs Are Divisible by K Solution
1508 Range Sum of Sorted Subarray Sums Solution
1509 Minimum Difference Between Largest and Smallest Value in Three Moves Solution
1510 Stone Game IV Solution
1514 Path With Maximum Probability Solution
1518 Water Bottles Solution
1519 Number of Nodes in the Sub Tree With the same Label Solution
1523 Count Odd Numbers in an Interval Range Solution
1530 Number of Good Leaf Nodes Pairs Solution
1531 String Compression II Solution
1544 Make the String Great Solution
1545 Find Kth Bit in Nth Binary String Solution
1550 Three Consecutive Odds Solution
1552 Magnetic Force Between Two Balls Solution
1568 Minimum Number of Days to Disconnect Island Solution
1578 Minimum Time to Make Rope Colorful Solution
1579 Remove Max Number of Edges to Keep Graph Fully Traversable Solution
1584 Min Cost to Connect all Points Solution
1586 Longest Subarray of 1s After Deleting One Element Solution
1590 Make Sum Divisible by P Solution
1593 Split a String Into the Max Number of Unique Substrings Solution
1598 Crawler Log Folder Solution
1605 Minimum Number of Days to Make M Bouquets Solution
1608 Special Array With X Elements Greater than or Equal X Solution
1627 Last Moment Before all Ants Fall out of a Plank Solution
1636 Sort Array by Increasing Frequency Solution
1653 Minimum Deletions to Make String Balanced Solution
1657 Determine IF Two Strings Are Close Solution
1662 Check IF Two String Arrays Are Equivalent Solution
1671 Minimum Number of Removals to Make Mountain Array Solution
1672 Richest Customer Wealth Solution
1680 Concatenation of Consecutive Binary Numbers Solution
1684 Count the Number of Consistent Strings Solution
1701 Average Waiting Time Solution
1704 Determine IF String Halves Are Alike Solution
1706 Where will the Ball Fall Solution
1711 Find Valid Matrix Given Row and Column Sums Solution
1717 Maximum Score from Removing Substrings Solution
1723 Maximum Number of Achievable Transfer Requests Solution
1770 Minimum Deletions to Make Character Frequencies Unique Solution
1776 Minimum Operations to Reduce X to Zero Solution
1791 Find Center of Star Graph Solution
1813 Sentence Similarity III Solution
1823 Find the Winner of the Circular Game Solution
1829 Maximum Xor for each Query Solution
1832 Check IF the Sentence IS Pangram Solution
1833 Maximum ICE Cream Bars Solution
1834 Single Threaded Cpu Solution
1894 Find the Student That will Replace the Chalk Solution
1905 Count Sub Islands Solution
1926 Nearest Exit from Entrance in Maze Solution
1937 Maximum Number of Points With Cost Solution
1942 The Number of the Smallest Unoccupied Chair Solution
1945 Sum of Digits of String After Convert Solution
1957 Delete Characters to Make Fancy String Solution
1962 Remove Stones to Minimize the Total Solution
1963 Minimum Number of Swaps to Make the String Balanced Solution
1971 Find IF Path Exists in Graph Solution
1996 The Number of Weak Characters in the Game Solution
2000 Minimum Speed to Arrive on Time Solution
2007 Find Original Array from Doubled Array Solution
2022 Convert 1d Array Into 2d Array Solution
2028 Find Missing Observations Solution
2037 Minimum Number of Moves to Seat Everyone Solution
2044 Count Number of Maximum Bitwise or Subsets Solution
2045 Second Minimum Time to Reach Destination Solution
2053 Kth Distinct String in an Array Solution
2058 Find the Minimum and Maximum Number of Nodes Between Critical Points Solution
2070 Most Beautiful Item for each Query Solution
2095 Delete the Middle Node of a Linked List Solution
2096 Step by Step Directions from a Binary Tree Node to Another Solution
2101 Last Day where You can Still Cross Solution
2131 Longest Palindrome by Concatenating Two Letter Words Solution
2134 Minimum Swaps to Group all 1s Together II Solution
2136 Earliest Possible Day of Full Bloom Solution
2181 Merge Nodes in Between Zeros Solution
2191 Sort the Jumbled Numbers Solution
2192 All Ancestors of a Node in a Directed Acyclic Graph Solution
2196 Create Binary Tree from Descriptions Solution
2220 Minimum Bit Flips to Convert Number Solution
2225 Find Players With Zero or One Losses Solution
2244 Minimum Rounds to Complete all Tasks Solution
2246 Longest Path With Different Adjacent Characters Solution
2256 Minimum Average Difference Solution
2259 Remove Digit from Number to Maximize Result Solution
2260 Minimum Consecutive Cards to Pick up Solution
2275 Largest Combination With Bitwise and Greater than Zero Solution
2279 Maximum Bags With Full Capacity of Rocks Solution
2285 Maximum Total Importance of Roads Solution
2306 Naming a Company Solution
2326 Spiral Matrix IV Solution
2336 Smallest Number in Infinite Set Solution
2337 Remove Digit from Number to Maximize Result Solution
2347 Count Nodes Equal to Average of Subtree Solution
2348 Number of Zero Filled Subarrays Solution
2359 Find Closest Node to Given Two Nodes Solution
2360 Substring With Largest Variance Solution
2373 Largest Local Values in a Matrix Solution
2389 Longest Subsequence With Limited Sum Solution
2392 Build a Matrix With Conditions Solution
2406 Divide Intervals Into Minimum Number of Groups Solution
2416 Sum of Prefix Scores of Strings Solution
2418 Sort the People Solution
2419 Longest Subarray With Maximum Bitwise and Solution
2421 Number of Good Paths Solution
2456 Most Popular Video Creator Solution
2458 Height of Binary Tree After Subtree Removal Queries Solution
2461 Maximum Sum of Distinct Subarrays With Length K Solution
2462 Total Cost to Hire K Workers Solution
2463 Minimum Total Distance Traveled Solution
2469 Convert the Temperature Solution
2470 Number of Subarrays With Lcm Equal to K Solution
2471 Minimum Number of Operations to Sort a Binary Tree by Level Solution
2475 Number of Unequal Triplets in Array Solution
2476 Closest Nodes Queries in a Binary Search Tree Solution
2485 Find the Pivot Integer Solution
2486 Append Characters to String to Make Subsequence Solution
2490 Circular Sentence Solution
2491 Divide Players Into Teams of Equal Skill Solution
2501 Longest Square Streak in an Array Solution
2519 Find the Original Array of Prefix Xor Solution
2520 Count the Digits That Divide a Number Solution
2521 Distinct Prime Factors of Product of Array Solution
2522 Partition String Into Substrings With Values at most K Solution
2530 Maximal Score After Applying K Operations Solution
2544 Alternating Digit Sum Solution
2545 Sort the Students by Their Kth Score Solution
2546 Apply Bitwise Operations to Make Strings Equal Solution
2558 Take Gifts from the Richest Pile Solution
2559 Count Vowel Strings in Ranges Solution
2582 Pass the Pillow Solution
2583 Kth Largest Sum in a Binary Tree Solution
2601 Prime Subtraction Operation Solution
2641 Cousins in Binary Tree II Solution
2678 Number of Senior Citizens Solution
2681 Put Marbles in Bags Solution
2684 Maximum Number of Moves in a Grid Solution
2696 Minimum String Length After Removing Substrings Solution
2699 Modify Graph Edge Weights Solution
2707 Extra Characters in a String Solution
2751 Robot Collisions Solution
2807 Insert Greatest Common Divisors in Linked List Solution
2914 Minimum Number of Changes to Make Binary String Beautiful Solution
2938 Separate Black and White Balls Solution
2976 Minimum Cost to Convert String I Solution
3011 Find IF Array can Be Sorted Solution
3016 Minimum Number of Pushes to Type Word II Solution
3043 Find the Length of the Longest Common Prefix Solution
3097 Shortest Subarray With or at Least K II Solution
3110 Score of a String Solution
3133 Minimum Array End Solution
3163 String Compression III Solution
3217 Delete Nodes from Linked List Present in Array Solution

About

Documenting my LeetCode journey one problem at a time. Feel free to use this repository's public template

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published