#K9076. Two Sum Indices

    ID: 37824 Type: Default 1000ms 256MiB

Two Sum Indices

Two Sum Indices

Given an array of integers and a target integer \(T\), your task is to find two distinct indices \(i\) and \(j\) such that \(\text{nums}[i] + \text{nums}[j] = T\). It is guaranteed that there is exactly one solution. You may not use the same element twice, and the answer should be returned in the order in which the elements appear in the array (i.e. the index of the first element encountered should appear first).

Note: The indices are 0-indexed.

inputFormat

The input is given via standard input (stdin) in the following format:

  1. An integer \(n\) representing the number of elements in the array.
  2. A single line containing \(n\) space-separated integers representing the elements of the array.
  3. An integer \(T\) on a new line that represents the target sum.

outputFormat

Output via standard output (stdout) a single line with two space-separated integers representing the indices of the two numbers that add up to \(T\). The first integer should be the index of the first number and the second integer should be the index of the second number.

## sample
4
2 7 11 15
9
0 1