201 questions
Coding interview questions
Original problems covering the patterns interviewers reuse: arrays and hashing, two pointers, sliding windows, trees, graphs, dynamic programming, and the data-structure design questions that arrive as follow-ups.
Every solution is Python, and every solution passes the tests printed beside it. Problem statements, examples and hints are free on every page; the worked approach and solution are in the company guides.
- 3Sum
- 3Sum Closest
- Accounts Merge
- Add Two Numbers
- Alien Dictionary
- All Nodes Distance K in Binary Tree
- Asteroid Collision
- Balanced Binary Tree
- Basic Calculator
- Basic Calculator II
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock with Cooldown
- Binary Search
- Binary Search Tree Iterator
- Binary Tree Level Order Traversal
- Binary Tree Maximum Path Sum
- Binary Tree Right Side View
- Binary Tree Vertical Order Traversal
- Burst Balloons
- Bus Routes
- Candy
- Capacity To Ship Packages Within D Days
- Car Fleet
- Cheapest Flights Within K Stops
- Climbing Stairs
- Clone Graph
- Coin Change
- Coin Change II
- Combination Sum
- Combination Sum II
- Construct Binary Tree from Preorder and Inorder Traversal
- Container With Most Water
- Contains Duplicate
- Contiguous Array
- Continuous Subarray Sum
- Copy List with Random Pointer
- Count Good Nodes in Binary Tree
- Count Number of Nice Subarrays
- Counting Bits
- Course Schedule
- Course Schedule II
- Daily Temperatures
- Decode String
- Decode Ways
- Delete and Earn
- Design Add and Search Words Data Structure
- Design Hit Counter
- Diameter of Binary Tree
- Distinct Subsequences
- Edit Distance
- Employee Free Time
- Encode and Decode Strings
- Evaluate Division
- Evaluate Reverse Polish Notation
- Find All Duplicates in an Array
- Find First and Last Position of Element in Sorted Array
- Find Median from Data Stream
- Find Minimum in Rotated Sorted Array
- Find Peak Element
- First Missing Positive
- Flatten Binary Tree to Linked List
- Flatten Nested List Iterator
- Fruit Into Baskets
- Game of Life
- Gas Station
- Generate Parentheses
- Graph Valid Tree
- Group Anagrams
- Hand of Straights
- House Robber
- House Robber II
- Implement Trie (Prefix Tree)
- Insert Delete GetRandom O(1)
- Insert Interval
- Interleaving String
- Invert Binary Tree
- Is Graph Bipartite?
- Jump Game
- Jump Game II
- K Closest Points to Origin
- Koko Eating Bananas
- Kth Largest Element in a Stream
- Kth Largest Element in an Array
- Kth Smallest Element in a BST
- Kth Smallest Element in a Sorted Matrix
- Largest Rectangle in Histogram
- Letter Combinations of a Phone Number
- LFU Cache
- Linked List Cycle
- Logger Rate Limiter
- Longest Arithmetic Subsequence
- Longest Common Subsequence
- Longest Consecutive Sequence
- Longest Increasing Subsequence
- Longest Palindromic Substring
- Longest Repeating Character Replacement
- Longest Substring with At Most K Distinct Characters
- Longest Substring with At Most Two Distinct Characters
- Longest Substring Without Repeating Characters
- Lowest Common Ancestor of a Binary Search Tree
- Lowest Common Ancestor of a Binary Tree
- LRU Cache
- Majority Element
- Max Area of Island
- Max Consecutive Ones III
- Maximal Square
- Maximum Depth of Binary Tree
- Maximum Product Subarray
- Maximum Subarray
- Maximum Sum Circular Subarray
- Median of Two Sorted Arrays
- Meeting Rooms
- Meeting Rooms II
- Merge Intervals
- Merge K Sorted Lists
- Merge Sorted Array
- Merge Two Sorted Lists
- Min Cost Climbing Stairs
- Min Cost to Connect All Points
- Min Stack
- Minimum Height Trees
- Minimum Interval to Include Each Query
- Minimum Path Sum
- Minimum Size Subarray Sum
- Minimum Window Substring
- Missing Ranges
- Move Zeroes
- My Calendar I
- N-Queens
- Network Delay Time
- Next Greater Element II
- Non-overlapping Intervals
- Number of 1 Bits
- Number of Connected Components in an Undirected Graph
- Number of Islands
- Number of Islands II
- Number of Longest Increasing Subsequence
- Pacific Atlantic Water Flow
- Paint House
- Palindrome Partitioning
- Palindromic Substrings
- Partition Equal Subset Sum
- Partition Labels
- Peeking Iterator
- Perfect Squares
- Permutation in String
- Permutations
- Pow(x, n)
- Product of Array Except Self
- Random Pick with Weight
- Range Sum Query - Immutable
- Reconstruct Itinerary
- Redundant Connection
- Regular Expression Matching
- Remove Duplicates from Sorted Array
- Remove K Digits
- Remove Nth Node From End of List
- Reorder List
- Reorganize String
- Reverse Bits
- Reverse Linked List
- Rotate Array
- Rotate Image
- Rotting Oranges
- Same Tree
- Search a 2D Matrix
- Search in Rotated Sorted Array
- Serialize and Deserialize Binary Tree
- Set Matrix Zeroes
- Shortest Path in Binary Matrix
- Single Number
- Sliding Window Maximum
- Sort Colors
- Spiral Matrix
- Split Array Largest Sum
- Squares of a Sorted Array
- String to Integer (atoi)
- Subarray Sum Equals K
- Subarrays with K Different Integers
- Subsets
- Subsets II
- Subtree of Another Tree
- Sum of Two Integers
- Surrounded Regions
- Swim in Rising Water
- Target Sum
- Task Scheduler
- Time Based Key-Value Store
- Top K Frequent Elements
- Trapping Rain Water
- Two Sum
- Unique Paths
- Valid Anagram
- Valid Palindrome
- Valid Parentheses
- Validate Binary Search Tree
- Walls and Gates
- Word Break
- Word Ladder
- Word Search
- Word Search II
Free starter pack
13 must-tier questions with full solutions
Sign in with an email, no purchase, and read them in the full reader.