When Hashmaps Solve Hard Problems

Use hashmaps in hard problems when:

1.1. You need to count occurrences or track frequencies in a sliding window

2.2. You're looking for pairs or subarrays with a specific sum or property

3.3. You need coordinate compression or value-to-index mapping

4.4. You're implementing a cache with specific eviction rules

The pattern: define what lookup you need, then design keys and values to support that lookup in O(1)O(1).