Covers algorithmic patterns that use arrays together with hash based maps or dictionaries to achieve efficient lookup and counting. Topics include frequency counting, duplicate detection, two sum and k sum variants, sliding window with counts, index mapping, grouping by keys, and using hash maps to reduce time complexity from quadratic to linear. Emphasize insertion deletion and lookup costs, collision and memory considerations, trade offs between using hash maps versus sorting or two pointer techniques, and typical interview problem families that rely on combining arrays with associative containers.
MediumTechnical
0 practiced
Implement 'all_pairs(nums, target)' in Python that returns a list of unique pairs of values (not indices) that sum to target. The input may contain duplicates but output should not include duplicate value pairs. Example: nums=[1,1,2,3,2], target=3 -> [[1,2]]. Use a hashmap to count values and explain handling of (x,x) pairs.
HardTechnical
0 practiced
You must support categorical features with extremely high cardinality (up to 100M distinct categories). Propose strategies using hash maps, the hashing trick (feature hashing), Count-Min Sketch, frequency cutoff, and learned embeddings. Compare memory, collision/error impact on model quality, ability to update categories without retraining, and monitoring considerations.
MediumTechnical
0 practiced
Implement 'subarray_sum_equals_k(nums, k)' in Python that returns True if any contiguous subarray sums to k. Array may contain negative numbers. Use prefix sums with a hashmap mapping prefix_sum to count or earliest index to achieve O(n) expected time. Example: nums=[1,2,3], k=5 -> True. Explain variations: return indices, count all subarrays equal to k.
HardSystem Design
0 practiced
Design a system to deduplicate 10 billion text documents (avg 2KB) at ingest time with expected duplicate fraction 5%. Requirements: near-real-time detection (<1s per doc), false positive rate < 1e-6, throughput 50k docs/sec, incremental updates allowed. Describe hashing strategy, sharding, storage choices, collision handling and verification, memory estimates, and fallback strategies.
MediumTechnical
0 practiced
Given an array of event intervals represented as (start, end), compute the maximum number of concurrent events. Implement using a hashmap-based sweep-line that records +1 at start and -1 at end then sweeps sorted keys. Explain time/space trade-offs and how to adapt the approach for streaming workloads with bounded memory.
Unlock Full Question Bank
Get access to hundreds of Arrays and Hash Map Operations interview questions and detailed answers.