Pattern Recognition Drill
Easy Hash Maps
The Problem
Given prices and a budget, find two items that sum to exactly the budget.
What approach would you use?
Think about it before scrolling down.
Identical to two sum. For each price, check complement in hash map. O(n).
Sort prices + two pointers. O(n log n). Need to map back to original indices.
Common Trap
Recognize this as a two-sum variant — don't overthink the story framing.