# | Problem | Solution | Time | Space | Tag |
---|---|---|---|---|---|
1 | Two Sum | TypeScript | O(n) | O(n) | Array, Hash Table |
2 | Move Zeroes | TypeScript | O(n) | O(1) | Array, Two Pointers |
3 | Valid Palindrome | TypeScript | O(n) | O(n) | String, Two Pointers |
4 | Summary Ranges | TypeScript | O(n) | O(n) | Array |
5 | Merge Two Sorted Lists | TypeScript | O(n + m) | O(1) | Linked List, Recursion |
6 | Squares of a Sorted Array | TypeScript | O(n) | O(n) | Array, Two Pointers, Sorting |
7 | Reverse Linked List | TypeScript | O(n) | O(1) | Linked List, Recursion |
8 | Valid Parentheses | TypeScript | O(n) | O(n) | String, Stack |
9 | Maximum Product of Three Numbers | TypeScript | O(nlogn) | O(1) | Array, Math, Sorting |
10 | Maximum Average Subarray I | TypeScript | O(n) | O(1) | Array, Sliding Window |
11 | Intersection of Two Arrays II | TypeScript | O(n + m) | O(min(n, m)) | Array, Hash Table, Two Pointers, Binary Search, Sorting |
12 | Valid Palindrome II | TypeScript | O(n) | O(1) | Two Pointers, String Greedy |
# | Problem | Solution | Time | Space | Tag |
---|---|---|---|---|---|
1 | String Compression | TypeScript | O(n) | O(n) | Two Pointers, String |
2 | Add Two Numbers | TypeScript | O(n) | O(1) | Linked List, Math, Recursion |
3 | Insert Delete GetRandom O(1) | TypeScript | O(1) | O(n) | Array, Hash Table, Math, Design, Randomized |
4 | Group Anagrams | TypeScript | O(n*k log(k)) | O(n*K) | Array, Hash Table, String, Sorting |
5 | Subarray Sum Equals K | TypeScript | O(n) | O(n) | Array, Hash Table, Prefix Sum |
6 | Merge Intervals | TypeScript | O(n log n) | O(n) | Array, Sorting |
7 | Top K Frequent Words | TypeScript | O(n log n) | O(n + k) | Hash Table, String, Trie, Sorting, Heap (Priority Queue), Bucket Sort, Counting |
8 | Longest Subarray of 1's After Deleting One Element | TypeScript | O(n) | O(1) | Array, Dynamic Programming, Sliding Window |
9 | Maximize Distance to Closest Person | TypeScript | O(n) | O(1) | Array |
10 | Find the Prefix Common Array of Two Arrays | TypeScript | O(n) | O(n) | Array, Hash Table |
11 | Find All Anagrams in a String | TypeScript | O(n) | O(1) | Hash Table, String, Sliding Window |
12 | Binary Tree Level Order Traversal | TypeScript | O(n) | O(n) | Tree, Breadth-First, Search, Binary Tree |
13 | Number of Islands | TypeScript | O(m * n) | O(m * n) | Array, Depth-First, Search Breadth-First Search, Union Find, Matrix |