Backend Developer
Hash maps and sets questions
193 questions on Hash maps and sets for backend developers, easiest first.
Easy 55
- Paths across a 3 × 7 grideasy
- Average cost of a hash map lookupeasy
- Worst case for a hash map lookupeasy
- Removing duplicates with a Seteasy
- Number keys in a plain objecteasy
- Iteration order of a Mapeasy
- When to choose Map over a plain objecteasy
- Set of look-alike objectseasy
- Counting letters in a wordeasy
- Two Sum with a hash mapeasy
- Reading a key that is not in a Mapeasy
- What load factor meanseasy
- Safe counting in a Python dicteasy
- Checking a key by its valueeasy
- Intersecting two lists of IDseasy
- Counting entries in a Mapeasy
- Missing key in a Python Countereasy
- Adding a value that is already in a Seteasy
- Grouping with defaultdicteasy
- Building a Map from pairseasy
- Looping over a Mapeasy
- Repeated membership checkseasy
- Does a string have all unique characterseasy
- Adding stock to an inventory mapeasy
- Does a sentence use every lettereasy
- Counting jewels among stoneseasy
- What Map.delete returnseasy
- Equal keys and hash valueseasy
- null keys in Java mapseasy
- Avoiding loops in graph searcheasy
- What HashMap.put returnseasy
- What in checks on a Python dicteasy
- Creating an empty set in Pythoneasy
- The in operator on a plain objecteasy
- Memory used by a hash mapeasy
- Counting with getOrDefault in Javaeasy
- Argument order in Map.forEacheasy
- Tallying voteseasy
- Removing duplicates but keeping ordereasy
- Choosing a structure for a contact lookupeasy
- Items in exactly one of two setseasy
- What HashSet.add returnseasy
- Turning a Map into an object for JSONeasy
- Looping over keys and values in Pythoneasy
- String and number keys in a Mapeasy
- Removing a missing item from a Python seteasy
- Set size after a deleteeasy
- Type of keys from Object.keyseasy
- Emptying a Mapeasy
- What a bucket is in a hash tableeasy
- Counting words regardless of caseeasy
- Checking a block listeasy
- Inverting a Python dicteasy
- Unique letters in a wordeasy
- Stopping a coupon from being reusedeasy
Medium 79
- Ways to make an amount from coinsmedium
- Loop order in coin countingmedium
- Ways to decode a digit stringmedium
- Decoding a string that starts with zeromedium
- Plus and minus signs that reach a targetmedium
- Ways a word appears as a subsequencemedium
- Group anagrams togethermedium
- Order of steps in Two Summedium
- Duplicate within k positionsmedium
- Longest consecutive run in O(n)medium
- Isomorphic stringsmedium
- Matching words to a patternmedium
- Fixed array or map for letter countsmedium
- First non-repeating charactermedium
- Top k frequent elements faster than sortingmedium
- Can a note be built from a magazinemedium
- Detecting a loop in repeated digit squaresmedium
- Separate chaining vs open addressingmedium
- Cost of resizing a hash tablemedium
- What makes a good hash functionmedium
- Overriding equals without hashCodemedium
- Changing a key after putting it in a setmedium
- Using a list as a dict key in Pythonmedium
- Grid coordinates as a JavaScript keymedium
- Caching data per object without leaksmedium
- Intersection keeping duplicatesmedium
- Count subarrays that sum to kmedium
- Longest subarray with equal 0s and 1smedium
- Subarrays with sum divisible by kmedium
- Counting four-list sums to zeromedium
- Bulls and Cows hintmedium
- Core of a URL shortenermedium
- Repeated 10-letter DNA sequencesmedium
- Total spend per customermedium
- Insert, delete and get random in O(1)medium
- Designing a basic hash setmedium
- Sort characters by frequencymedium
- Most common words in support ticketsmedium
- Slope as a map keymedium
- Song pairs with total divisible by 60medium
- Can an array be split into pairs divisible by kmedium
- Subtracting two Countersmedium
- Memoizing a recursive functionmedium
- Two Sum on a stream of numbersmedium
- Joining two lists in memorymedium
- Find the extra lettermedium
- Finding duplicate filesmedium
- Which Sudoku box a cell belongs tomedium
- Cloning a graph with cyclesmedium
- Copying a list with random pointersmedium
- Longest palindrome from given lettersmedium
- Crossing the fewest bricksmedium
- Counting pairs with equal valuesmedium
- Ranking products by salesmedium
- Printing each message at most once per 10 secondsmedium
- Key-value store with timestampsmedium
- Words that appear in only one sentencemedium
- Common letters with Counter &medium
- TreeMap or HashMap in Javamedium
- Iteration order of a Go mapmedium
- In-memory Map cache across many serversmedium
- Detecting duplicate supplier invoicesmedium
- Array or map for counting small integersmedium
- Breaking ties in most frequentmedium
- Key for an undirected edgemedium
- Tie order in Counter.most_commonmedium
- Inverting a map with repeated valuesmedium
- Counting anagram pairsmedium
- Shortest subarray with the same degreemedium
- Longest harmonious subsequencemedium
- Most candy types one sister can getmedium
- Characters common to every wordmedium
- Finding the final city of a tripmedium
- Does a walk revisit a pointmedium
- Duplicate accounts with different email spellingmedium
- Totals by city and productmedium
- Checking that two Sets are equalmedium
- Built-in Set operations in JavaScriptmedium
- Grouping into lists in Javamedium
Hard 59
- Counting DP mod 1e9+7 in JavaScripthard
- Tiling a 2 × 4 board with dominoeshard
- How many longest increasing subsequenceshard
- Ways two dice add up to 7hard
- Hash flooding attackshard
- Java HashMap worst case since Java 8hard
- Deleting entries while loopinghard
- Designing an O(1) LRU cachehard
- Word counts that break on "constructor"hard
- NaN and -0 as Map keyshard
- Floating point numbers as keyshard
- Is Python dict order guaranteedhard
- Adding a cache server without reshufflinghard
- What a Bloom filter can promisehard
- Sharing a HashMap across threadshard
- Unique pairs with a given differencehard
- When a sorted array beats a hash maphard
- Key order in a plain objecthard
- When a Java HashMap resizeshard
- Prefix count updated too earlyhard
- First or last index of a prefix sumhard
- How soon 32-bit hashes collidehard
- Reducing rolling hash collisionshard
- Deleting from an open-addressing tablehard
- Clustering in linear probinghard
- Counting unique visitors at huge scalehard
- Set order changing between runshard
- Same request, two cache entrieshard
- Cuckoo hashing lookupshard
- Two Java strings with the same hashCodehard
- Bug in an at-most-two-distinct windowhard
- Detecting a loop in a linked listhard
- Distinct values in every windowhard
- Stopping double charges on retrieshard
- Python keys 1, 1.0 and Truehard
- int[] as a HashMap keyhard
- Adding to a Map during forEachhard
- One key overloading a cache shardhard
- Avoiding resize pauses in a HashMaphard
- Dataclass objects in a Python sethard
- Deduplicating more data than fits in memoryhard
- Perfect hashing for a fixed key sethard
- Why consistent hashing uses virtual nodeshard
- Error direction of a Count-Min Sketchhard
- NaN membership in a Python sethard
- Counting all pairs that sum to a targethard
- Array or map for sparse large IDshard
- Making map output stable for testshard
- Designing an O(1) LFU cachehard
- What Object.groupBy returnshard
- Deleting from a dict while loopinghard
- Counting balanced 0 and 1 subarrayshard
- A test that depends on HashMap orderhard
- Race in check-then-puthard
- Concurrent writes to a Go maphard
- Memo cache misses for equal argumentshard
- Hash index vs B-tree indexhard
- Rows that match columns in a gridhard
- Replacing % with a bit maskhard