1. Two Sum
Practice Two Sum for free on NudgeCode: Easy, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Given an integer array nums and an integer target, return the indices of the two numbers that add up to target, smaller index first.
Each input has exactly one answer, and you may not use the same element twice.
Example
nums = [2,7,11,15], target = 9 -> [0,1]
Constraints
- 2 <= nums.length <= 10^4
- -10^9 <= nums[i], target <= 10^9