Let's start by looking at LeetCode 1 Two Sum.
You're given an array of integers nums and a target. Your task is to return the indices of two numbers that add up to target.
For example, if nums = [2,7,11,15] and target = 9, you'd return [0,1], since .
Before moving to the next unit, think about this: brute force checks every pair in . What data structure lets you check whether the complement (target - nums[i]) exists in average time? This is the key idea behind the classic Two Sum hash map approach.
Constraints: , values from to .