#K41877. Two Sum: Find the Pair Indices

    ID: 26963 Type: Default 1000ms 256MiB

Two Sum: Find the Pair Indices

Two Sum: Find the Pair Indices

You are given an array of integers and a target value. Your task is to find two distinct indices \(i\) and \(j\) (0-indexed) such that:

[ \text{nums}[i] + \text{nums}[j] = \text{target} ]

It is guaranteed that there is exactly one solution, and you may not use the same element twice. Print the indices separated by a space. The order of the indices should follow the order in which the solution is discovered.

inputFormat

The input is given on standard input and consists of the following lines:

  • The first line contains an integer \(n\) denoting the number of elements in the array.
  • The second line contains \(n\) space-separated integers representing the array \(nums\).
  • The third line contains an integer \(target\) representing the target sum.

outputFormat

Output two space-separated integers representing the indices of the two numbers in the array that add up to the target. The indices should be printed on a single line.

## sample
4
2 7 11 15
9
0 1

</p>