Group leetcode-algorithms Tele: https://t.me/+ST0unit9nTRkYjhl
- Create a directory named
<problem_id>.<Name-To-Directory>underEasy/,Medium/, orHard/. - Add a
solution.mdfile inside that directory. Optional files:description.md,solution-go.md,solution-rust.md,solution-cpp.md. - Example layout:
Easy/350.Intersection-of-Two-Arrays-II/
├── solution.md
└── description.md
- Markdown style guide: https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/Rules.md
- When adding a new solution, add a row to the matching difficulty table below.
Total: 184 problems with at least one solution file.
Solution links use variant names when multiple approaches or languages exist (main = solution.md, others = solution-<variant>.md).
| Problem | LeetCode | Solution |
|---|---|---|
| 100. Same Tree | Link | main |
| 101. Symmetric Tree | Link | main |
| 1021. Remove Outermost Parentheses | Link | main |
| 1189. Maximum Number of Balloons | Link | main |
| 136. Single Number | Link | main |
| 145. Binary Tree Postorder Traversal | Link | main |
| 155. Min Stack | Link | hashmap |
| 219. Contains Duplicate II | Link | hashmap · slidingwindow |
| 222. Count Complete Tree Nodes | Link | main |
| 350. Intersection of Two Arrays II | Link | main |
| 495. Teemo Attacking | Link | main |
| 590. N-ary Tree Postorder Traversal | Link | main |
| 594. Longest Harmonious Subsequence | Link | main |
| 860. Lemonade Change | Link | main |
| 884. Uncommon Words from Two Sentences | Link | main |
| 1260. Shift 2D Grid | Link | main |
| 1331. Rank Transform of an Array | Link | main |
| 1399. Count Largest Group | Link | main |
| 1455. Check If A Word Occurs As A Prefix Of Any Word In A Sentence | Link | main |
| 1475. Final Prices With A Special Discount In A Shop | Link | main |
| 1486. XOR Operation in an Array | Link | main |
| 1518. Water Bottles | Link | main |
| 1539. Kth Missing Positive Number | Link | main |
| 1550. Three Consecutive Odds | Link | main |
| 1598. Crawler Log Folder | Link | cpp |
| 1636. Sort Array By Increasing Frequency | Link | main |
| 1684. Count The Number Of Consistent Strings | Link | main |
| 1945. Sum of Digits of String After Convert | Link | main |
| 1967. Number of Strings That Appear as Substrings in Word | Link | main |
| 1979. Find Greatest Common Divisor of Array | Link | main |
| 2022. Convert 1D Array Into 2D Array | Link | main |
| 2053. Kth Distinct String in an Array | Link | main |
| 2191. Sort the Jumbled Numbers | Link | main |
| 2418. Sort the People | Link | main |
| 2558. Take Gifts From The Richest Pile | Link | main |
| 2582. Passing The Pillow | Link | rust |
| 2696. Minimum String Length After Removing Substrings | Link | main |
| 3216. Lexicographically Smallest String After a Swap | Link | main |
| 3314. Construct the Minimum Bitwise Array I | Link | main |
| 3375. Minimum Operations to Make Array Values Equal to k | Link | main |
| 3637. Trionic Array I | Link | main |
| 3658. GCD of Odd and Even Sums | Link | main |
| 3754. Concatenate Non-Zero Digits and Multiply by Sum I | Link | main |
| Problem | LeetCode | Solution |
|---|---|---|
| 33. Search in rotated sorted array | Link | main |
| 40. Combination Sum II | Link | main |
| 63. Unique Paths II | Link | main |
| 81. Search In Rotated Sorted Array | Link | main |
| 122. Best Time to Buy and Sell Stock II | Link | main |
| 128. Longest Consecutive Sequence | Link | [main](Medium/128. Longest-Consecutive-Sequence/solution.md) |
| 155. Min Stack | Link | main |
| 179. Largest number | Link | main |
| 208. Implement trie (prefix tree) | Link | main |
| 209. Minimum Size Subarray Sum | Link | main |
| 238. Product of Array Except Self | Link | main |
| 241. Different Ways to Add Parentheses | Link | main |
| 264. Ugly Number II | Link | main |
| 300. Longest Increasing Subsequence | Link | [bottomup](Medium/300. Longest-Increasing-Subsequence/solution-bottomup.md) · [greedy-patience-sort](Medium/300. Longest-Increasing-Subsequence/solution-greedy-patience-sort.md) · [topdown](Medium/300. Longest-Increasing-Subsequence/solution-topdown.md) |
| 307. Range sum query Mutable | Link | main |
| 539. Minimum Time Difference | Link | main |
| 567. Permutation in String | Link | main |
| 624. Maximum Distance in Arrays | Link | main |
| 654. Maximum Binary Tree | Link | main |
| 725. Split Linked List in Parts | Link | main |
| 729. My Calendar I | Link | main |
| 739. Daily Temperatures | Link | main |
| 763. Partition Labels | Link | main |
| 790. Domino and Tromino Tiling | Link | main |
| 807. Max Increase to Keep City Skyline | Link | main |
| 826. Most Profit Assigning Work | Link | main |
| 840. Magic Squares In Grid | Link | main |
| 853. Car Fleet | Link | main |
| 874. Walking Robot Simulation | Link | main |
| 875. KoKo Eating Bananas | Link | main |
| 885. Spiral Matrix III | Link | main |
| 921. Minimum Add To Make Parentheses Valid | Link | main |
| 947. Most Stones Removed with Same Row or Column | Link | main |
| 959. Regions Cut By Slashes | Link | main |
| 981. Time Based Key Value Store | Link | main |
| 1014. Best Sightseeing Pair | Link | main |
| 1038. Binary Search Tree to Greater Sum Tree | Link | main |
| 1052. Grumpy Bookstore Owner | Link | main |
| 1081. Smallest Subsequence of Distinct Characters | Link | main |
| 1110. Delete Nodes And Return Forest | Link | main |
| 1140. Stone Game II | Link | main |
| 1190. Reverse Substrings Between Each Pair Of Parentheses | Link | main |
| 1261. Find Elements in a Contaminated Binary Tree | Link | main |
| 1288. Remove Covered Intervals | Link | main |
| 1291. Sequential Digits | Link | main |
| 1310. XOR Queries of a Subarray | Link | main |
| 1371. Find the Longest Substring Containing Vowels in Even Counts | Link | main |
| 1382. Balance A Binary Search Tree | Link | [main](Medium/1382. Balance-A-Binary-Search-Tree/solution.md) |
| 1395. Count Number of Teams | Link | main |
| 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | Link | main |
| 1482. Minimum number of days to make m bouquets | Link | main |
| 1497. Check If Array Pairs Are Divisible by k | Link | main |
| 1530. Number of Good Leaf Nodes Pairs | Link | main |
| 1552. Magnetic Force Between Two Balls | Link | main |
| 1593. Split a String Into the Max Number of Unique Substrings | Link | main |
| 1605. Find Valid Matrix Given Row and Column Sums | Link | [main](Medium/1605.Find-Valid -Matrix-Given-Row-and-Column-Sums/solution.md) |
| 1653. Minimum Deletions to Make String Balanced | Link | main |
| 1701. Average Waiting Time | Link | main |
| 1717. Maximum Score From Removing Substrings | Link | main |
| 1760. Minimum Limit Of Balls In A Bag | Link | main |
| 1823. Find The Winner Of The Circular Game | Link | main |
| 1833. Maximum Ice Cream Bars | Link | main |
| 1846. Maximum Element After Decreasing and Rearranging | Link | main |
| 1894. Find the Student that Will Replace the Chalk | Link | main |
| 1905. Count Sub Islands | Link | cpp · go · java |
| 1922. Count Good Numbers | Link | main |
| 1942. The Number of the Smallest Unoccupied Chair | Link | main |
| 1963. Minimum Number of Swaps to Make the String Balanced | Link | main |
| 1975. Maxium Matrix Sum | Link | main |
| 2028. Find Missing Observations | Link | main |
| 2058. Find the Minimum and Maximum Number of Nodes Between Critical Points | Link | main |
| 2070. Most Beautiful Item for Each Query | Link | main |
| 2096. Step By Step Directions From A Binary Tree Node To Another | Link | go |
| 2109. Adding Spaces To A String | Link | main |
| 2161. Partition Array According to Given Pivot | Link | main |
| 2181. Merge Nodes in Between Zeros | Link | main |
| 2182. Construct string with repeat limit | Link | main |
| 2192. All Ancestor of a Node in a Directed Acyclic Graph | Link | main |
| 2196. Create Binary Tree From Descriptions | Link | cpp · go · java · rust |
| 2226. Maximum candies allocate to K children | Link | [main](Medium/2226. Maximum-candies-allocate-to-K-children/solution.md) |
| 2270. Number Of Ways To Split Array | Link | main |
| 2285. Maximum Total Importance of Roads | Link | main |
| 2326. Spiral Matrix IV | Link | main |
| 2337. Move Pieces to Obtain a String | Link | main |
| 2419. Longest Subarray With Maximum Bitwise AND | Link | main |
| 2461. Maximum Sum of Distinct Subarrays With Length K | Link | main |
| 2491. Divide Players Into Teams of Equal Skill | Link | main |
| 2492. Minimum Score of a Path Between Two Cities | Link | main |
| 2501. Longest Square Streak in an Array | Link | main |
| 2583. Kth Largest Sum in a Binary Tree | Link | main |
| 2601. Prime Subtraction Operation | Link | main |
| 2685. Count the Number of Complete Components | Link | main |
| 2707. Extra Characters In A String | Link | main |
| 2779. Maximum Beauty Of An Array After Applying Operation | Link | main |
| 2825. Make String a Subsequence Using Cyclic Increments | Link | main |
| 2924. Find Champion II | Link | main |
| 3016. Minimum Number of Pushes to Type Word II | Link | main |
| 3020. Find the Maximum Number of Elements in Subset | Link | main |
| 3043. Find the Length of the Longest Common Prefix | Link | main |
| 3097. Shortest Subarray With OR at Least K II | Link | main |
| 3217. Delete Nodes From Linked List Present in Array | Link | main |
| 3218. Minimum Cost for Cutting Cake I | Link | main |
| 3254. Find the Power of K Size Subarrays I | Link | main |
| 3286. Find a Safe Walk Through a Grid | Link | main |
| 3499. Maximize Active Section with Trade I | Link | main |
| 3513. Number of Unique XOR Triplets I | Link | main |
| 3532. Path Existence Queries in a Graph I | Link | main |
| 3756. Concatenate Non-Zero Digits and Multiply by Sum II | Link | main |
| 3867. Sum of GCD of Formed Pairs | Link | main |
| Problem | LeetCode | Solution |
|---|---|---|
| 11. Container With Most Water | Link | main |
| 23. Merge k Sorted Lists | Link | main |
| 37. Sudoku Solver | Link | [main](Hard/37. Sudoku Solver/solution.md) |
| 41. First Missing Positive | Link | main |
| 188. Best Time to Buy and Sell Stock IV | Link | main |
| 212. Word Search II | Link | main |
| 214. Shortest Palindrome | Link | main |
| 239. Sliding Window Maximum | Link | main |
| 295. Find Median from Data Stream | Link | main |
| 502. IPO | Link | main |
| 664. Strange Printer | Link | main |
| 719. Find K th Smallest Pair Distance | Link | java · main |
| 726. Number of Atoms | Link | go · main |
| 773. Sliding Puzzle | Link | main |
| 862. Shortest Subarray with Sum at Least K | Link | main |
| 995. Minimum Number of K Consecutive Bit Flips | Link | main |
| 1106. Parsing A Boolean Expression | Link | main |
| 1301. Number of Paths with Max Score | Link | main |
| 1579. Remove Max Number of Edges to Keep Graph Fully Traversable | Link | go · rust · main |
| 2071. Maximum Number of Tasks You Can Assign | Link | main |
| 2302. Count Subarrays With Score Less Than K | Link | main |
| 2392. Build a Matrix With Conditions | Link | main |
| 2416. Sum of Prefix Scores of Strings | Link | main |
| 2503. Maximum Number of Points From Grid Queries | Link | main |
| 2551. Put Marbles in Bags | Link | main |
| 2751. Robot Collisions | Link | main |
| 3219. Minimum Cost for Cutting Cake II | Link | main |
| 3336. Find the Number of Subsequences With Equal GCD | Link | main |
| 3363. Find the Maximum Number of Fruits Collected | Link | [main](Hard/3363. Find-the-Maximum-Number-of-Fruits-Collected/solution.md) |
| 3534. Path Existence Queries in a Graph II | Link | main |
| 3620. Network Recovery Pathways | Link | main |
| 3739. Count Subarrays With Majority Element II | Link | main |