#K67307. Two Sum Problem
Two Sum Problem
Two Sum Problem
You are given an array of integers and a target integer T. Your task is to find two distinct indices i and j such that:
\(a_i + a_j = T\)
If there are multiple solutions, you may output any one of them. It is guaranteed that exactly one solution exists.
The program should read input from stdin
and print the result to stdout
. The output should consist of two indices separated by a space.
inputFormat
The first line contains a single integer n — the number of elements in the array.
The second line contains n space-separated integers representing the array.
The third line contains a single integer T — the target sum.
outputFormat
Output two integers representing the indices (0-indexed) of the two numbers that add up to the target. The indices should be printed on one line separated by a space.
## sample4
2 7 11 15
9
0 1
</p>