#K56417. Two Sum: Find Indices Summing to Target
Two Sum: Find Indices Summing to Target
Two Sum: Find Indices Summing to Target
Given an array of integers and a target integer \(target\), your task is to find two distinct indices \(i\) and \(j\) (with \(i < j\)) such that:
\(a_i + a_j = target\)
It is guaranteed that there exists exactly one solution for each test case. The indices are zero-based.
inputFormat
The input is given via stdin in the following format:
n target a1 a2 a3 ... an
where n is the number of elements and target is the target sum, followed by n integers representing the array.
outputFormat
Output the two indices (separated by a space) corresponding to the two numbers that add up to \(target\). The output should be written to stdout.
## sample4 9
2 7 11 15
0 1