#C14276. Two Sum Problem
Two Sum Problem
Two Sum Problem
Given an array of integers and a target integer \(T\), your task is to find two distinct indices \(i\) and \(j\) such that the sum of the elements at these indices is equal to \(T\), i.e., \(a_i + a_j = T\). It is guaranteed that there is exactly one solution.
Note: Each input will have exactly one solution, and you may not use the same element twice.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(n\), the number of elements in the array.
- The second line contains \(n\) space-separated integers representing the elements of the array.
- The third line contains an integer \(T\), the target sum value.
outputFormat
Output to standard output (stdout) two integers separated by a space: the indices of the two numbers that add up to \(T\).
## sample4
2 7 11 15
9
0 1