Make sure you have the following installed:
Python 3.8+
Node.js 18+ and npm
(Optional) virtualenv for Python
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pytest
npm install
npm test
| Name | Tags | Solution |
|---|---|---|
| Max value | Arrays |
Python |
| Is-Monotonic | Arrays |
TypeScript , Python |
| 2D Array - DS | Arrays |
TypeScript |
| Left Rotation | Arrays |
TypeScript |
| New Year Chaos | Arrays |
TypeScript |
| Minimum Swaps 2 | Arrays |
TypeScript |
| Array Manipulation | Arrays |
TypeScript |
| Ransom Note | Hash Tables |
TypeScript |
| Two Strings | Hash Tables |
TypeScript |
| Sherlock and Anagrams | Hash Tables |
TypeScript |
| Count Triplets | Hash Tables |
TypeScript |
| Frequency Queries | Hash Tables |
TypeScript |
| Making Anagrams | Strings |
TypeScript |
| Alternating Characters | Strings |
TypeScript |
| Sherlock and the Valid String | Strings |
TypeScript |
| Special String Again | Strings |
TypeScript |
| Common Child | Strings |
|
| Contains-Duplicate | Arrays, Hash Tables |
TypeScript |
| Valid Anagram | Arrays, Hash Tables |
TypeScript |
| Two Sum | Arrays, Hash Tables |
TypeScript |
| Group Anagrams | Arrays, Hash Tables |
|
| Top K Frequent Elements | Arrays, Hash Tables |
|
| Product of Array Except Self | Arrays, Hash Tables |
|
| Valid Sudoku | Arrays, Hash Tables |
|
| Encode and Decode Strings | Arrays, Hash Tables |
|
| Longest Consecutive Sequence | Arrays, Hash Tables |
|
| Valid Palindrome | Two Pointers |
Typescript |
| Two Sum II Input Array Is Sorted | Two Pointers |
|
| 3Sum | Two Pointers |
|
| Container With Most Water | Two Pointers |
|
| Trapping Rain Water | Two Pointers |
|
| Valid Parentheses | Stack |
Typescript |
| Min Stack | Stack |
|
| Evaluate Reverse Polish Notation | Stack |
|
| Generate Parentheses | Stack |
|
| Daily Temperatures | Stack |
|
| Car Fleet | Stack |
|
| Largest Rectangle In Histogram | Stack |
|
| Binary Search | Binary Search |
|
| Search a 2D Matrix | Binary Search |
|
| Koko Eating Bananas | Binary Search |
|
| Find Minimum In Rotated Sorted Array | Binary Search |
|
| Search In Rotated Sorted Array | Binary Search |
|
| Time Based Key Value Store | Binary Search |
|
| Median of Two Sorted Arrays | Binary Search |
|
| Best Time to Buy And Sell Stock | Sliding Window |
|
| Longest Substring Without Repeating Characters | Sliding Window |
|
| Longest Repeating Character Replacement | Sliding Window |
|
| Permutation In String | Sliding Window |
|
| Minimum Window Substring | Sliding Window |
|
| Sliding Window Maximum | Sliding Window |
|
| Reverse Linked List | Linked List |
|
| Merge Two Sorted Lists | Linked List |
|
| Reorder List | Linked List |
|
| Remove Nth Node From End of List | Linked List |
|
| Copy List With Random Pointer | Linked List |
|
| Add Two Numbers | Linked List |
|
| Linked List Cycle | Linked List |
|
| Find The Duplicate Number | Linked List |
|
| LRU Cache | Linked List |
|
| Merge K Sorted Lists | Linked List |
|
| Reverse Nodes In K Group | Linked List |
|
| Invert Binary Tree | Trees |
|
| Maximum Depth of Binary Tree | Trees |
|
| Diameter of Binary Tree | Trees |
|
| Balanced Binary Tree | Trees |
|
| Same Tree | Trees |
|
| Subtree of Another Tree | Trees |
|
| Lowest Common Ancestor of a Binary Search Tree | Trees |
|
| Binary Tree Level Order Traversal | Trees |
|
| Binary Tree Right Side View | Trees |
|
| Count Good Nodes In Binary Tree | Trees |
|
| Validate Binary Search Tree | Trees |
|
| Kth Smallest Element In a Bst | Trees |
|
| Construct Binary Tree From Preorder And Inorder Traversal | Trees |
|
| Binary Tree Maximum Path Sum | Trees |
|
| Serialize And Deserialize Binary Tree | Trees |
|
| Implement Trie Prefix Tree | Tries |
|
| Design Add And Search Words Data Structure | Tries |
|
| Word Search II | Tries |
|
| Kth Largest Element In a Stream | Heap / Priority Queue |
|
| Last Stone Weight | Heap / Priority Queue |
|
| K Closest Points to Origin | Heap / Priority Queue |
|
| Kth Largest Element In An Array | Heap / Priority Queue |
|
| Task Scheduler | Heap / Priority Queue |
|
| Design Twitter | Heap / Priority Queue |
|
| Find Median From Data Stream | Heap / Priority Queue |
|
| Subsets | Baktracking |
|
| Combination Sum | Baktracking |
|
| Permutations | Baktracking |
|
| Subsets II | Baktracking |
|
| Combination Sum II | Baktracking |
|
| Word Search | Baktracking |
|
| Palindrome Partitioning | Baktracking |
|
| Letter Combinations of a Phone Number | Baktracking |
|
| N Queens | Baktracking |
Typescript |
| Insert Interval | Intervals |
|
| Merge Intervals | Intervals |
|
| Non Overlapping Intervals | Intervals |
|
| Meeting Rooms | Intervals |
|
| Meeting Rooms II | Intervals |
|
| Minimum Interval to Include Each Query | Intervals |
|
| Maximum Subarray | Greedy |
|
| Jump Game | Greedy |
|
| Jump Game II | Greedy |
|
| Gas Station | Greedy |
|
| Hand of Straights | Greedy |
|
| Merge Triplets to Form Target Triplet | Greedy |
|
| Partition Labels | Greedy |
|
| Valid Parenthesis String | Greedy |
|
| Number of Islands | Graphs |
|
| Clone Graph | Graphs |
|
| Max Area of Island | Graphs |
|
| Pacific Atlantic Water Flow | Graphs |
|
| Surrounded Regions | Graphs |
|
| Rotting Oranges | Graphs |
|
| Walls And Gates | Graphs |
|
| Course Schedule | Graphs |
|
| Course Schedule II | Graphs |
|
| Redundant Connection | Graphs |
|
| Number of Connected Components In An Undirected Graph | Graphs |
|
| Graph Valid Tree | Graphs |
|
| Word Ladder | Graphs |
|
| Reconstruct Itinerary | Advanced Graphs |
|
| Min Cost to Connect All Points | Advanced Graphs |
|
| Network Delay Time | Advanced Graphs |
|
| Swim In Rising Water | Advanced Graphs |
|
| Alien Dictionary | Advanced Graphs |
|
| Cheapest Flights Within K Stops | Advanced Graphs |
|
| Climbing Stairs | 1-D DP |
|
| Min Cost Climbing Stairs | 1-D DP |
|
| House Robber | 1-D DP |
|
| House Robber II | 1-D DP |
|
| Longest Palindromic Substring | 1-D DP |
|
| Palindromic Substrings | 1-D DP |
|
| Decode Ways | 1-D DP |
|
| Coin Change | 1-D DP |
|
| Maximum Product Subarray | 1-D DP |
|
| Word Break | 1-D DP |
|
| Longest Increasing Subsequence | 1-D DP |
|
| Partition Equal Subset Sum | 1-D DP |
|
| Unique Paths | 2-D DP |
|
| Longest Common Subsequence | 2-D DP |
|
| Best Time to Buy And Sell Stock With Cooldown | 2-D DP |
|
| Coin Change II | 2-D DP |
|
| Target Sum | 2-D DP |
|
| Interleaving String | 2-D DP |
|
| Longest Increasing Path In a Matrix | 2-D DP |
|
| Distinct Subsequences | 2-D DP |
|
| Edit Distance | 2-D DP |
|
| Burst Balloons | 2-D DP |
|
| Regular Expression Matching | 2-D DP |
|
| Single Number | Bit Manipulation |
|
| Number of 1 Bits | Bit Manipulation |
|
| Counting Bits | Bit Manipulation |
|
| Reverse Bits | Bit Manipulation |
|
| Missing Number | Bit Manipulation |
|
| Sum of Two Integers | Bit Manipulation |
TypeScript |
| Reverse Integer | Bit Manipulation |
|
| Hamming-distance | Bit Manipulation |
TypeScript |
| Rotate Image | Math & Geometry |
|
| Spiral Matrix | Math & Geometry |
|
| Set Matrix Zeroes | Math & Geometry |
|
| Happy Number | Math & Geometry |
|
| Plus One | Math & Geometry |
|
| Pow(x, n) | Math & Geometry |
|
| Multiply Strings | Math & Geometry |
|
| Detect Squares | Math & Geometry |
|
| Factorial | Math, Recursion |
TypeScript |
| Name | Solution |
|---|---|
| Linked-list | TypeScript |
| Doubly-Linked-list | TypeScript |
| Stack | TypeScript |
| Hash Table | TypeScript |
| Queue | TypeScript |
MIT © Raghib Hasan