Hard
Two Sum
Read a list of integers and a target. Print the indices i < j of the first pair (smallest j, then smallest i) whose values add up to the target, or
-1 if none. Use a dictionary for speed.Input
A line of integers, then the target.
Output
Two indices or -1.
Sample 1
Input
2 7 11 15 9
Output
0 1
Sample 2
Input
3 2 4 6
Output
1 2
Output appears here