Problem | Leetcode | Difficulty | Topics | Notes |
---|---|---|---|---|
217 - Contains Duplicate | Leetcode | 🟢 | Array, Hash Table, Sorting | Use dictionary (hashmap) to check for duplicates |
242 - Valid Anagram | Leetcode | 🟢 | Hash Table, String, Sorting | Two dictionaries (hashmaps), |
1 - Two Sum | Leetcode | 🟢 | Array, Hash Table | TBD |
49 - Group Anagrams | Leetcode | 🟡 | Array, Hash Table, String, Sorting | Use dictionary (hashmap) with sorted letters of a word (key) and array of anagrams (value) |
347 - Top K Frequent Elements | Leetcode | 🟡 | Array, Hash Table, Divide and Conquer, Sorting, Heap (Priority Queue), Bucket Sort, Counting, Quickselect | TBD |
238 - Product of Array Except Self | Leetcode | 🟡 | Array, Prefix Sum | Tricky to understand the principle. Make two passes to compute products: first in-order, second in-reverse. |
36 - Valid Sudoku | Leetcode | 🟡 | Array, Hash Table, Matrix | Use 3 hashmaps (dictionaries): rows, columns and subsets (3x3, use 'row / 3', 'column / 3' as a key). Check for duplicates in sets |
271 - Encode and Decode Strings | Leetcode | 🟡 | TBD | Separator is a word length + a sign (e.g., |
128 - Longest Consecutive Sequence | Leetcode | 🟡 | Array, Hash Table, Union Find | Loop and find out if the num is a start of a sequence ( |
Problem | Leetcode | Difficulty | Topics | Notes |
---|---|---|---|---|
125 - Valid Palindrome | Leetcode | 🟢 | Two Pointers, String | Left and right pointer. Compare left/right chars (lowercased) in |
167 - Two Sum II - Input Array Is Sorted | Leetcode | 🟡 | Array, Two Pointers, Binary Search | In |
15 - 3Sum | Leetcode | 🟡 | Array, Two Pointers, Sorting | Similar to the "2 Sum" approach. Sort the array first. Skip dups while iterating. Then apply "2 Sum" method, for each num and update left pointer (while no dup value found). |
11 - Container With Most Water | Leetcode | 🟡 | Array, Two Pointers, Greedy | The left p is the start, and the right p is the end of the array. Calculate the max area |
42 - Trapping Rain Water | Leetcode | 🔴 | Array, Two Pointers, DP, Stack, Monotonic Stack | TBD |
Problem | Leetcode | Difficulty | Topics | Notes |
---|---|---|---|---|
20 - Valid Parentheses | Leetcode | 🟢 | String, Stack | Use simple stack structure ( |
155 - Min Stack | Leetcode | 🟡 | Stack, Design | Store two arrays (one for numbers, another for min values). |
150 - Evaluate Reverse Polish Notation | Leetcode | 🟡 | Array, Math, Stack | Iterate through the strings and use switch. In case of an operator, pop 2 values, calcuate the expression (mind the order) and push to the stack. In case of a number (default case), just push it to the stack. Return top value. |
22 - Generate Parentheses | Leetcode | 🟡 | String, DP, Backtracking | Implement a backtracking function and call it recursively. Pass |
739 - Daily Temperatures | Leetcode | 🟡 | Array, Stack, Monotonic Stack | TBD to deep dive |
853 - Car Fleet | Leetcode | 🟡 | Array, Stack, Sorting, Monotonic Stack | Notes |
84 - Largest Rectangle In Histogram | Leetcode | 🔴 | TBD | TBD |
Problem | Leetcode | Difficulty | Topics | Notes |
---|---|---|---|---|
704 - Binary Search | Leetcode | 🟢 | Array, Binary Search | TBD |