Search across blog, articles, projects, courses, and community posts
Given a list of integers and a target, find the two positions whose values add up to the target.
Input:
n, the number of values.n integers.Output: the two zero-based indices i j with i < j, separated by a space. Exactly one such pair exists.
2 <= n <= 1000, values and target between -10^9 and 10^9. Each input has exactly one valid pair, and the same position cannot be used twice.
4 2 7 11 15 9
0 1
3 3 2 4 6
1 2