- Array (10)
- Binary (5)
- Dynamic Programming (11)
- Graph (8)
- Interval (5)
- Linked-List (6)
- Matrix (4)
- String (10)
- Tree (14)
- Heap (3)
If input array is sorted then
- Binary search
- Two pointers
If asked for all permutations/subsets then
- Backtracking
If given a tree then
- DFS
- BFS
If given a graph then
- DFS
- BFS
If given a linked list then
- Two pointers
If recursion is banned then
- Stack
If must solve in-place then
- Swap corresponding values
- Store one or more different values in the same pointer
If asked for maximum/minumum subarray/subset/options then
- Dynamic programming
If asked for top/least K items then
- Heap
If asked for common strings then
- Map
- Trie
Else
- Map/Set for O(1) time & O(n) space
- Sort input for O(nlogn) time and O(1) space
It is highly recommended to read chapters 1, 2, 3, 4, 8, and 10 of [Cracking The Coding Interview] to familiarize yourself with the following data structures and their operations:
- Arrays
- Maps
- Linked Lists
- Queues
- Heaps
- Stacks
- Trees
- Graphs
In addition, you should have a good grasp on common algorithms such as:
- Breadth-first search
- Depth-first search
- Binary search
- Recursion
-Important-and-Useful-links-from-all-over-the-LeetCode
- 14 Patterns to Ace Any Coding Interview Question
- Grokking the Coding Interview: Patterns for Coding Questions
- Cracking the Coding Interview PDF
- Sean Prashad's Leetcode Patterns
- Top Interview Questions - Leetcode Medium Collection
- Technical Interview Handbook - Interview Prep Materials for Busy Engineers
- Comprehensive Data Structure and Algorithm Study Guide
- Two Sum
- Best Time to Buy and Sell Stock
- Contains Duplicate
- Product of Array Except Self
- Maximum Subarray
- Maximum Product Subarray
- Find Minimum in Rotated Sorted Array
- Search in Rotated Sorted Array
- 3Sum
- Container With Most Water
- Climbing Stairs
- Coin Change
- Longest Increasing Subsequence
- Longest Common Subsequence
- Word Break Problem
- Combination Sum
- House Robber
- House Robber II
- Decode Ways
- Unique Paths
- Jump Game
- Clone Graph
- Course Schedule
- Pacific Atlantic Water Flow
- Number of Islands
- Longest Consecutive Sequence
- Alien Dictionary (Leetcode Premium)
- Graph Valid Tree (Leetcode Premium)
- Number of Connected Components in an Undirected Graph (Leetcode Premium)
- Insert Interval
- Merge Intervals
- Non-overlapping Intervals
- Meeting Rooms (Leetcode Premium)
- Meeting Rooms II (Leetcode Premium)
- Reverse a Linked List
- Detect Cycle in a Linked List
- Merge Two Sorted Lists
- Merge K Sorted Lists
- Remove Nth Node From End Of List
- Reorder List
- Longest Substring Without Repeating Characters
- Longest Repeating Character Replacement
- Minimum Window Substring
- Valid Anagram
- Group Anagrams
- Valid Parentheses
- Valid Palindrome
- Longest Palindromic Substring
- Palindromic Substrings
- Encode and Decode Strings (Leetcode Premium)
- Maximum Depth of Binary Tree
- Same Tree
- Invert/Flip Binary Tree
- Binary Tree Maximum Path Sum
- Binary Tree Level Order Traversal
- Serialize and Deserialize Binary Tree
- Subtree of Another Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Validate Binary Search Tree
- Kth Smallest Element in a BST
- Lowest Common Ancestor of BST
- Implement Trie (Prefix Tree)
- Add and Search Word
- Word Search II