← All problems
Two Sum
Given an array of integers nums and an integer target, return indices of the two numbers that add up to target. Each input has exactly one solution.
Complexity
Time O(n), Space O(n)
Common pitfalls
- Returning values instead of indices
- Using the same element twice
Your solution
Log in to save your code and track progress.