Advanced Hash Table Problems for Coding Interviews
52 advanced Hash Table problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 0 intermediate and 52 advanced. The companies that ask them most often are Google, Amazon, Bloomberg, Meta.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Search in a Rotated Sorted Array (Advanced)
- Tree Nodes at Distance K (Advanced)
- Largest Divisible Subset Size (Advanced)
- Randomized Set With Duplicates (Advanced)
- IP Longest Prefix Match (Advanced)
- Tree Height After Subtree Removal Queries (Advanced)
- Similar String Groups (Advanced)
- Alien Dictionary Order (Advanced)
- Count Distinct Palindromic Subsequences (Advanced)
- Numbers From a Digit Set (Advanced)
- Shortest Superstring Length (Advanced)
- Longest Duplicate Substring (Advanced)
- Distinct Echo Substrings (Advanced)
- Word Search II Count (Advanced)
- Palindrome Pairs Count (Advanced)
- Count Unique Characters of All Substrings (Advanced)
- Remove Duplicate Letters (Advanced)
- Number of Visible People in a Queue (Advanced)
- IPO (Advanced)
- Kth Smallest Number in Multiplication Table (Advanced)
- Kth Smallest Prime Fraction (Advanced)
- Word Break II (Advanced)
- Unique Paths III (Advanced)
- Aho-Corasick Pattern Count (Advanced)
- Max Points on a Line (Advanced)
- Closest Pair of Points (Advanced)
- Convex Hull Vertex Count (Advanced)
- Cut Off Trees for Golf Event (Advanced)
- Largest Component by Common Factor (Advanced)
- Bricks Falling When Hit (Advanced)
- Ways to Build Sturdy Brick Wall (Advanced)
- Count All Possible Routes (Advanced)
- Smallest Sufficient Team (Advanced)
- Allocate Mailboxes (Advanced)
- Minimum Total Distance Traveled (Advanced)
- Count Distinct Subsequences (Advanced)
- Count Distinct Substrings (Advanced)
- Brace Expansion II (Advanced)
- Minimum Operations to Make Array Continuous (Advanced)
- Maximum Frequency Stack (Advanced)
- Meeting Rooms III (Advanced)
- Product of All Divisors (Advanced)
- Maximum Distinct Elements After Adjustments (Advanced)
- Path Cover Counts on Tree (Advanced)
- Number of Distinct Subset XOR Values (Advanced)
- Minimum Adjacent Swaps to Make Anagram Equal (Advanced)
- Capped Stars and Bars Count (Advanced)
- Count Numbers With Exactly K Distinct Digits (Advanced)
- Minimum Cost to Sort Distinct Array by Swaps (Advanced)
- Distinct Powers Count (Advanced)
- Distinct Letter Arrangements Modulo (Advanced)
- Intervals Inside Another Interval (Advanced)
Related
Frequently asked questions
How do I get good at hash table problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run hash table problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.