Interview questions
Find a company or topic. Read the sources, then practice.
Loading the question library…
Find a company or topic. Read the sources, then practice.
Loading the question library…
Showing 1–25
Design an in-memory hierarchical file system that supports path parsing and operations like mkdir, ls, addContentToFile (append/create), and readContentFromFile, requiring you…
Companies: Anchorage Digital, Capital One, Coupang, Datadog +5
Design · Hash Table · Sorting · String
Last reported Nov 2026
Implement an LFU cache with O(1) average-time get and put operations that evicts the least-frequently-used key when capacity is exceeded, breaking ties by least-recently-used…
Companies: Amazon, Apple, Cisco, Goldman Sachs +3
Design · Doubly-Linked List · Hash Table · Linked List
Last reported Nov 2026
Implement an LRUCache that supports O(1) average-time get(key) returning the value or -1 and put(key, value) which inserts or updates a key and, if capacity…
Companies: Adobe, Amazon, Anthropic, Apple +29
Data Structure Design · Design · Doubly-Linked List · Hash Table
Last reported Oct 2026
Design a data structure that supports incrementing and decrementing string counts (removing keys when their count drops to zero) and can return any key with…
Companies: Atlassian, LinkedIn, Meta, Microsoft +2
Design · Doubly-Linked List · Hash Table · Linked List
Last reported Oct 2026
Group the input strings into lists of anagrams — i.e., strings that contain the same multiset of letters — and return the groups in any…
Companies: Amazon, Apple, Arize Ai, Bloomberg +14
Array · Hash Table · Sorting · String
Last reported Oct 2026
Count word frequencies and return the k most frequent words sorted by descending frequency, breaking ties by lexicographical order. The core challenge is combining frequency…
Companies: Apple, Microsoft, Oracle, Robinhood
Array · Bucket Sort · Counting · Hash Table
Last reported Oct 2026
Parse each directory string to extract full file paths and their contents, then group paths by identical file content and return all groups containing at…
Companies: Anthropic, Google, OpenAI
Array · Hash Table · String
Last reported Oct 2026
Find the length of the longest contiguous substring that contains no repeated characters. This is a classic sliding-window / two-pointer problem where you track seen…
Companies: Amazon, Apple, Autodesk, Bloomberg +12
Hash Table · Sliding Window · String
Last reported Oct 2026
Companies: Amazon, Apple, Meta
Binary Lifting · Binary Tree · Hash Table · Lowest Common Ancestor
Last reported Oct 2026
Given a list of words, design a class that can answer repeated queries returning the minimum index distance between two given words; optimize for many…
Companies: LinkedIn
Array · Design · Hash Table · String
Last reported Oct 2026
Given an integer array and k, return the k most frequent elements — the core challenge is to count element frequencies and extract the top-k…
Companies: Amazon, Bloomberg, Google, Meta +9
Array · Bucket Sort · Counting · Divide and Conquer
Last reported Oct 2026
Design a data structure supporting insert(val), remove(val), and getRandom() — which returns a uniformly random existing element — with each operation in average O(1) time…
Companies: Amazon, Apple, Bloomberg, Citadel +7
Array · Design · Hash Table · Math
Last reported Sep 2026
Implement a logger that decides whether to print a message at a given timestamp: return true if the message hasn't been printed in the last…
Companies: Amazon, Bloomberg, Google, Microsoft +3
Data Stream · Design · Hash Table
Last reported Sep 2026
Determine whether the string s can be segmented into a sequence of one or more words from wordDict (words may be reused). The core challenge…
Companies: Amazon, Google, Grammarly, Meta +3
Array · Brute-Force Search · Dynamic Programming · Hash Table
Last reported Sep 2026
Return the index of the first character in s that occurs exactly once (or -1 if none). This is typically solved by counting character frequencies…
Companies: Apple, Goldman Sachs
Counting · Hash Table · Queue · String
Last reported Sep 2026
Given repeating bus routes and start/target stops, find the minimum number of bus rides required to go from source to target (or -1 if impossible)…
Companies: Amazon, Bloomberg, Coupang, PayPal +3
Array · Breadth-First Search · Hash Table
Last reported Sep 2026
For each string in an array, find the shortest substring that does not occur in any other string (choose the lexicographically smallest one among ties)…
Companies: Airbnb
Array · Hash Table · String · Trie
Last reported Sep 2026
Find the smallest substring of s that contains all characters of t (including duplicates), or return "" if none exists. This is typically solved with…
Companies: Amazon, LinkedIn, Lyft, Meta +2
Hash Table · Sliding Window · String
Last reported Sep 2026
Design a data structure for a multiset that supports insert(val) (adding even duplicate occurrences), remove(val) (removing a single occurrence), and getRandom() (returning an…
Companies: CrowdStrike, LinkedIn, Okta
Array · Design · Hash Table · Math
Last reported Sep 2026
Given tasks labeled A–Z and a cooldown n, compute the minimum number of CPU intervals (including idles) to finish all tasks so that identical tasks…
Companies: Amazon, Apple, Databricks, Docker +3
Array · Counting · Greedy · Hash Table
Last reported Sep 2026
Design a spreadsheet supporting set/get and sum operations where sum formulas can reference individual cells and rectangular ranges; the core challenge is maintaining a…
Companies: Airbnb, Discord
Array · Design · Graph Theory · Hash Table
Last reported Sep 2026
Implement a HashMap for integer keys/values without using built-in hash table libraries that supports put, get, and remove operations. The core challenge is to design…
Companies: Anduril, Canva, Chewy, Goldman Sachs +2
Array · Design · Hash Function · Hash Table
Last reported Sep 2026
Design a Spreadsheet class with 26 columns and a specified number of rows that supports setCell and resetCell operations and stores integer values (unset cells…
Companies: Citadel, Discord
Array · Design · Hash Table · Matrix
Last reported Sep 2026
Convert a fraction to its decimal string form, enclosing any repeating fractional cycle in parentheses. The core challenge is simulating long division while handling sign…
Companies: Goldman Sachs, Meta
Hash Table · Math · String
Last reported Sep 2026
Given an initially all-water m×n grid, process a sequence of add-land operations and return the number of islands (4-directionally connected land components) after each…
Companies: LinkedIn, Microsoft, Uber
Array · Hash Table · Union-Find
Last reported Sep 2026