LeetCode problems' solutions for coding interview preparation.
- Encode and Decode Strings
- Meeting Rooms
- Meeting Rooms II
- Alien Dictionary
- Walls and Gates
- Graph Valid Tree
- Number of Connected Components In An Undirected Graph
- Arrays & Hashing
- Easy
- Contains Duplicate
- Valid Anagram
- Two Sum
- Medium
- Group Anagrams
- Top K Frequent Elements
- Valid Sudoku
- Product of Array Except Self
- Longest Consecutive Sequence
- Hard
- Easy
- Two Pointers
- Easy
- Valid Palindrome
- Medium
- Two Sum II Input Array Is Sorted
- Container With Most Water
- 3Sum
- Hard
- Easy
- Sliding Window
- Easy
- Best Time to Buy and Sell Stock
- Medium
- Longest Substring Without Repeating Characters
- Permutation in String
- Hard
- Easy
- Stack
- Easy
- Valid Parentheses
- Medium
- Generate Parentheses
- Min Stack
- Evaluate Reverse Polish Notation
- Daily Temperatures
- Car Fleet
- Hard
- Easy
- Binary Search
- Easy
- Binary Search
- Medium
- Coco Eating Bananas
- Search a 2D Matrix
- Find Minimum in Rotated Sorted Array
- Search in Rotated Sorted Array
- Time Based Key-Value Store
- Hard
- Easy
- Linked List
- Easy
- Reverse Linked List
- Merge Two Sorted Lists
- Linked List Cycle
- Medium
- Remove Nth Node From End of List
- Add Two Numbers
- Copy List with Random Pointer
- LRU Cache
- Reorder List
- Find The Duplicate Number
- Hard
- Merge K Sorted Lists
- Reverse Nodes in k-Group
- Easy
- Trees
- Easy
- Maximum Depth of Binary Tree
- Invert Binary Tree
- Same Tree
- Diameter of a Binary Tree
- Balanced Binary Tree
- Subtree of Another Tree
- Medium
- Binary Tree Level Order Traversal
- Binary Tree Right Side View
- Count Good Nodes in Binary Tree
- Kth Smallest Element in a BST
- Lowest Common Ancestor of a Binary Search Tree
- Validate Binary Search Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Hard
- Binary Tree Maximum Path Sum
- Serialize and Deserialize Binary Tree
- Easy
- Heap/Priority Queue
- Easy
- Kth Largest Element in a Stream
- Last Stone Weight
- Medium
- K Closest Points to Origin
- Kth Largest Element in an Array
- Design Twitter
- Task Scheduler
- Hard
- Find Median from Data Stream
- Easy
- Backtracking
- Easy
- Medium
- Subsets
- Subsets II
- Combination Sum
- Permutations
- Hard
- Tries
- Easy
- Medium
- Implement Trie (Prefix Tree)
- Design Add and Search Words Data Structure
- Hard
- Graphs
- Easy
- Medium
- Number of Islands
- Max Area of Island
- Course Schedule
- Course Schedule II
- Redundant Connection
- Rotting Oranges
- Surrounded Regions
- Clone Graph
- Hard
- Word Ladder
- Advanced Graphs
- Easy
- Medium
- Min Cost to Connect All Points
- Network Delay Time
- Cheapest Flights Within K Stops
- Hard
- 1D Dynamic Programming
- Easy
- Climbing Stairs
- Min Cost Climbing Stairs
- Medium
- House Robber
- House Robber II
- Longest Palindromic Substring
- Palindromic Substrings
- Decode Ways
- Partition Equal Subset Sum
- Coin Change
- Maximum Product Subarray
- Word Break
- Hard
- Easy
- 2D Dynamic Programming
- Easy
- Medium
- Unique Paths
- Hard
- Greedy
- Easy
- Medium
- Maximum Subarray
- Jump Game
- Hard
- Intervals
- Easy
- Medium
- Insert Interval
- Hard
- Math & Geometry
- Easy
- Happy Number
- Plus One
- Medium
- Rotate Image
- Pow(x, n)
- Hard
- Easy
- Bit Manipulation
- Easy
- Single Number
- Number of 1 Bits
- Counting Bits
- Reverse Bits
- Missing Number
- Medium
- Hard
- Easy
- Slow Pointer and Fast Pointer
- Linked List Reversal
- Doubly Linked List
- Dictionaries that stores key-value pairs where the value is a ListNode or a TreeNode
- Concept of Deep Copy
- Two Pointers
- Sliding Window
- LIFO -> Probably a Stack
- FIFO -> Probably a Queue
- Queue where elements have priorities -> Heap
- Learn more about Floyd's Cycle-Detection Algorithm in an Array/Linked List.
- Remember how to validate a BST: range update while doing a DFS traversal.
- Remember how to calculate the LCA of a BST (The code is very very simple).
- Remember how to solve the problem "Binary Tree Maximum Sum" (Has a lot of corner and tricky cases).
- See the NeetCode solution for "Design Twitter".
- See the NeetCode solution for "Task Scheduler".
- Solve the "Find Minimum in Rotated Sorted Array" again.
- In Binary Search problems, think very carefully about whether you need to use
<
or<=
. - The "Median of Two Sorted Arrays" problem is very hard and full of tricks.
- The "3Sum" problem is very interesting.
- In the problem "Permutation in String", the left pointer always decrements the freqDict and the right pointer always increments the freqDict.
- The "Design Add and Search Words Data Structure" problem is very interesting and tricky. It's a good idea to do it one more time.
- The "Jump Game" problem is an excelent greedy problem.
- The "Maximum Product Subarray" problem is a tricky 1D DP problem worth reviewing.
- The "Word Break" problem is a very good 1D DP problem.