Leetcode solutions for 🚀 NeetCode.io
This repo hosts the solutions found on NeetCode.io including the solutions shown on the NeetCode YouTube channel. The site will periodically be updated with new solutions from this repo!
Solutions from these languages will be linked from NeetCode.io:
Python, Java, JavaScript, C++, Go, Swift, C#, TypeScript, Rust, Kotlin, Ruby, C, Scala and Dart
Solutions are also welcome for any other supported language on leetcode.com!
Please read the contributing guidlines before opening a PR
To contribute, please fork this repo and open a PR adding a missing solution from the supported languages.
If you would like to have collaborator permissions on the repo to merge your own PRs or review others' PRs please let me know.
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0125 - Valid Palindrome | ❌ |
❌ |
||||||||||||||
0680 - Valid Palindrome II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
1984 - Minimum Difference Between Highest And Lowest of K Scores | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
1768 - Merge Strings Alternately | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0344 - Reverse String | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0088 - Merge Sorted Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
0283 - Move Zeroes | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0026 - Remove Duplicates From Sorted Array | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0080 - Remove Duplicates From Sorted Array II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||
0167 - Two Sum II Input Array Is Sorted | ❌ |
❌ |
❌ |
|||||||||||||
0015 - 3Sum | ❌ |
❌ |
||||||||||||||
0018 - 4Sum | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||
0011 - Container With Most Water | ❌ |
❌ |
||||||||||||||
1498 - Number of Subsequences That Satisfy The Given Sum Condition | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||
0189 - Rotate Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
1968 - Array With Elements Not Equal to Average of Neighbors | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0881 - Boats to Save People | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||
0042 - Trapping Rain Water | ❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0121 - Best Time to Buy And Sell Stock | ❌ |
❌ |
||||||||||||||
0219 - Contains Duplicate II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
1343 - Number of Sub Arrays of Size K and Avg Greater than or Equal to Threshold | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||
0003 - Longest Substring Without Repeating Characters | ❌ |
❌ |
||||||||||||||
0424 - Longest Repeating Character Replacement | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0567 - Permutation In String | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
1838 - Frequency of The Most Frequent Element | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
0904 - Fruits into Basket | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||
1456 - Maximum Number of Vowels in a Substring of Given Length | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||
1888 - Minimum Number of Flips to Make The Binary String Alternating | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||
0209 - Minimum Size Subarray Sum | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||
0658 - Find K Closest Elements | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
1658 - Minimum Operations to Reduce X to Zero | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||
0076 - Minimum Window Substring | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0239 - Sliding Window Maximum | ❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0020 - Valid Parentheses | ❌ |
❌ |
❌ |
|||||||||||||
0682 - Baseball Game | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0225 - Implement Stack Using Queues | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0155 - Min Stack | ❌ |
❌ |
❌ |
|||||||||||||
0150 - Evaluate Reverse Polish Notation | ❌ |
❌ |
❌ |
|||||||||||||
2390 - Removing Stars From a String | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0946 - Validate Stack Sequences | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||
0022 - Generate Parentheses | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0735 - Asteroid Collision | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||
0739 - Daily Temperatures | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0901 - Online Stock Span | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0853 - Car Fleet | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0071 - Simplify Path | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0394 - Decode String | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0402 - Remove K Digits | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
1209 - Remove All Adjacent Duplicates In String II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0456 - 132 Pattern | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0895 - Maximum Frequency Stack | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0084 - Largest Rectangle In Histogram | ❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0208 - Implement Trie Prefix Tree | ❌ |
❌ |
❌ |
|||||||||||||
0211 - Design Add And Search Words Data Structure | ❌ |
❌ |
❌ |
|||||||||||||
2707 - Extra Characters in a String | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||
0212 - Word Search II | ❌ |
❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0703 - Kth Largest Element In a Stream | ❌ |
❌ |
❌ |
❌ |
||||||||||||
1046 - Last Stone Weight | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0973 - K Closest Points to Origin | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
0215 - Kth Largest Element In An Array | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0621 - Task Scheduler | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
0355 - Design Twitter | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||
1675 - Minimize Deviation in Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||
2542 - Maximum Subsequence Score | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||
1834 - Single Threaded Cpu | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||
1845 - Seat Reservation Manager | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||
1882 - Process Tasks Using Servers | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||
1985 - Find The Kth Largest Integer In The Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0767 - Reorganize String | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||
1405 - Longest Happy String | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||
1094 - Car Pooling | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||
0295 - Find Median From Data Stream | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||
1383 - Maximum Performance of a Team | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||
0502 - IPO | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0078 - Subsets | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0039 - Combination Sum | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0077 - Combinations | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0046 - Permutations | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0090 - Subsets II | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0040 - Combination Sum II | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0047 - Permutations II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0079 - Word Search | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0131 - Palindrome Partitioning | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0093 - Restore IP Addresses | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||
0017 - Letter Combinations of a Phone Number | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0473 - Matchsticks to Square | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||
1849 - Splitting a String Into Descending Consecutive Values | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||
1980 - Find Unique Binary String | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||
1239 - Maximum Length of a Concatenated String With Unique Characters | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||
0698 - Partition to K Equal Sum Subsets | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||
0051 - N Queens | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0052 - N Queens II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1631 - Path with Minimum Effort | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||
0332 - Reconstruct Itinerary | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
1584 - Min Cost to Connect All Points | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
0743 - Network Delay Time | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||
1514 - Path with Maximum Probability | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0778 - Swim In Rising Water | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||||
0269 - Alien Dictionary | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||
0787 - Cheapest Flights Within K Stops | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||
2421 - Number of Good Paths | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||
1579 - Remove Max Number of Edges to Keep Graph Fully Traversable | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
1489 - Find Critical and Pseudo Critical Edges in Minimum Spanning Tree | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0057 - Insert Interval | ❌ |
❌ |
❌ |
❌ |
❌ |
|||||||||||
0056 - Merge Intervals | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0435 - Non Overlapping Intervals | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0252 - Meeting Rooms | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||
0253 - Meeting Rooms II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||||
1288 - Remove Covered Intervals | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||
1851 - Minimum Interval to Include Each Query | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0352 - Data Stream as Disjoint Intervals | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0136 - Single Number | ❌ |
❌ |
❌ |
|||||||||||||
0191 - Number of 1 Bits | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0338 - Counting Bits | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0190 - Reverse Bits | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0268 - Missing Number | ❌ |
❌ |
❌ |
❌ |
||||||||||||
1470 - Shuffle the Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|||||||
0989 - Add to Array-Form of Integer | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||||||
0371 - Sum of Two Integers | ❌ |
❌ |
❌ |
❌ |
||||||||||||
0007 - Reverse Integer | ❌ |
❌ |
❌ |
|||||||||||||
0067 - Add Binary | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
Problem | articles | C | C++ | C# | Dart | GO | hints | Java | JS | Kotlin | Python | Ruby | Rust | Scala | Swift | TS |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2667 - Create Hello World Function | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||
2620 - Counter | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
||
2665 - Counter II | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2635 - Apply Transform over each Element in Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2634 - Filter Elements from Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2626 - Array Reduce Transformation | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2629 - Function Composition | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2666 - Allow One Function Call | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2623 - Memoize | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2632 - Curry | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2621 - Sleep | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2637 - Promise Time Limit | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2636 - Promise Pool | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2622 - Cache With Time Limit | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2627 - Debounce | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2676 - Throttle | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2628 - JSON Deep Equal | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
2633 - Convert Object to JSON String | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2675 - Array of Objects to Matrix | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2700 - Difference Between Two Objects | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2677 - Chunk Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
2625 - Flatten Deeply Nested Array | ❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
<div al |