Hash maps practice problems
Count and group by a key, and lookups stop costing a second loop. A concept: the material itself — what it is, and what it costs you to use. 25 problems in the bank train it, each with a worked example, a hint and a reference solution.
- Math
- Strings
- Arrays
- Hash maps
- Sorting
- Parsing
- Two pointers
- Sliding window
- Prefix sums
- Stacks
- Binary search
- Intervals
- Grids
- Greedy
- Recursion
- Simulation
- Bit manipulation
25 problems
- Which zone price applieseasy
- Look up the tax rate for a regioneasy
- Payment method surchargeeasy
- Drop the repeatseasy
- How many of eacheasy
- Longest stretch with no repeathard
- Score dice pairshard
- Which station has the least workhard
- The longest run with only two kindshard
- How many stretches add up to the figurehard
- Group stock by how soon it expiresmedium
- Split an order across warehousesmedium
- Is this status change allowedmedium
- Charge each request only oncemedium
- Count the words that mattermedium
- The best selling products this weekmedium
- Average spend per categorymedium
- Bucket some readingsmedium
- Count log lines by levelmedium
- Which required fields are missingmedium
- The most repeated wordmedium
- Are these two an anagrammedium
- Find the two that add upmedium
- Totals per categorymedium
- The first repeatmedium