AI Projects · Drill Room
Drill Room
Timed interview practice where the interviewer answers questions about the problem and never about the approach. This copy runs the clock and the rules; the real one also runs your code.
Approach first — 12 more words.
Two Sum
EasyGiven a sequence of integers and a target, find the positions of two distinct entries whose values add to the target. Exactly one valid result is guaranteed.
Constraints
- The sequence may contain negative values and repeated values.
- The two positions must be different, and the input may be empty only outside the promised case.
Examples
Input: values = [4, 9, 1, 6], target = 10
Output: [1, 2]
Input: values = [-3, 8, 5], target = 2
Output: [0, 2]