Problems by Topic
Browse our 59 interview problems organized by data structure and algorithm topic. Perfect for focused practice.
Available Topics
- Algorithms (19 problems)
- Arrays (8 problems)
- Data Structures (22 problems)
- Dynamic Programming (7 problems)
- General (16 problems)
- Graphs (2 problems)
- Hash Table (1 problems)
- Heap (1 problems)
- Linked List (1 problems)
- Queue (1 problems)
- Strings (2 problems)
- Trie (1 problems)
Algorithms (19 problems)
These cover the techniques interviewers reach for first: recursion, bit manipulation, string handling, and greedy scans. Be ready to state the time and space complexity of your approach out loud, since that is usually the first follow-up, and notice how many problems map onto one of the common coding patterns.
- Bit Manipulation: Essential Tricks and Techniques
- Bumblebee
- Card Trick Without the Trick
- Check if a Linked list is a Palindrome or Not
- Coin Rolls
- Cube
- Dijkstra’s Shortest Path Algorithm
- Find Longest Palindrome In A String
- int atoi( char* pStr )
- Kadane’s Algorithm: Maximum Subarray Sum
- Palindromes
- Print String Permutations
- Reverse a doubly linked list
- Reverse a String
- Right Rotate an array by k elements
- Sliding Window Maximum
- Sum it Up
- Treasure Island
- Word Search in Grid
Arrays (8 problems)
Array questions test how cleanly you handle indices, in-place swaps, and edge cases like empty or single-element input. Many reduce to a two pointers or sliding window pass, so reach for that before nesting loops.
- Amazon Interview Question: Count Negative Integers in Matrix
- Box ‘o Numbers
- Chessboard
- Missing or Duplicate Number in an Array
- Probability Distribution Function
- Reverse a String
- Right Rotate an array by k elements
- Sum Up a Pair in Array
Data Structures (22 problems)
Interviewers use these to check whether you can pick the right structure and reason about its operations across stacks, queues, linked lists, trees, and hash maps. Know the cost of insert, lookup, and delete for each, and be ready to say when a hash map is worth the extra memory for O(1) access.
- Building a Stack with a getMax() function
- Check if a Linked list is a Palindrome or Not
- Classic Weighing
- Find Out if a Linked List has a Cycle
- Find The Depth of a Binary Tree
- How many floors can an egg be dropped without breaking?
- Implement a rate limiter
- Implement LRU Cache
- Implement Trie (Prefix Tree)
- Linked List
- Missing country code
- Missing or Duplicate Number in an Array
- Probability Distribution Function
- Red Marbles, Blue Marbles
- Reverse a doubly linked list
- Reverse a String
- Right Rotate an array by k elements
- Serialize and Deserialize a Binary Tree
- Sum Up a Pair in Array
- Treasure Island
- Union-Find (Disjoint Set Union)
- Write a program for producer-consumer problem
Dynamic Programming (7 problems)
DP problems reward spotting overlapping subproblems and stating a clear recurrence. Start from the brute-force recursion, add memoization, then walk through the table you fill; the classic warm-ups here are the longest palindromic substring and maximum subarray.
- Find Longest Palindrome In A String
- Fruit Jar Problem
- How many floors can an egg be dropped without breaking?
- Kadane’s Algorithm: Maximum Subarray Sum
- Palindromes
- Prime number problem
- Red Marbles, Blue Marbles
General (16 problems)
This bucket is mostly brainteasers, probability puzzles, and math-flavored questions like the Monty Hall problem. Interviewers care about your reasoning out loud more than a memorized answer, so state your assumptions and sanity-check the result.
- 100 Factorial
- Check If a Number is Power of Two
- Clock
- Compute X^Y For Floats and Negative Values
- Function that Multiples 2 Integers
- Fuse on Fire
- Getting a fair result with an unfair coin
- Gold Chain
- Hard River Crossing
- Implement a Function to Return a Ratio
- Monty Hall Problem
- Server to Process Fair Number of Functions
- Storing 1 million phone numbers
- Topological Sort
- Write a Function for r and 5()
- XOR using NAND gates
Graphs (2 problems)
Graph rounds test traversal with BFS and DFS plus one weighted or connectivity algorithm. Be fluent in topological sort for ordering problems and union-find for connected components, since one of the two shows up in most graph interviews.
Hash Table (1 problems)
Hash-map questions probe collision handling, load factor, and when constant-time lookup is worth the extra memory. The LRU cache is the canonical example, pairing a map with a doubly linked list to get O(1) get and put.
Heap (1 problems)
Heaps come up for top-K and streaming-median problems where you need the largest or smallest element fast. Remember that push and pop are O(log n) while peeking at the root is O(1).
Linked List (1 problems)
Linked-list questions test pointer discipline: reversing a list, detecting a cycle with fast and slow pointers, and splicing nodes without losing the rest. Draw the pointers on paper before you write any code.
Queue (1 problems)
Queues show up in BFS and sliding-window problems, and the deque variant lets you push and pop from both ends in O(1). Sliding-window maximum is the standard test of whether you can keep a monotonic deque correct.
Strings (2 problems)
String problems check careful indexing, in-place edits, and edge cases around whitespace and character encoding. Clarify whether the input is mutable and whether comparisons are case-sensitive before you start coding.
Trie (1 problems)
Tries trade memory for fast prefix lookups, which makes them the structure to reach for in autocomplete and word-search-grid problems. Be ready to compare the space cost against a plain hash set of words.
