#K92187. Two Sum Problem

    ID: 38142 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

Given an array of integers and a target integer, find the indices of the two numbers that add up to the target. In other words, for an array \(nums\) and an integer \(target\), find indices \(i\) and \(j\) such that:

\(nums[i] + nums[j] = target\)

You may assume that each input has exactly one solution, and you may not use the same element twice.

inputFormat

The input is read from standard input and consists of three lines:

  1. The first line contains a single integer \(n\) which represents the number of elements in the array.
  2. The second line contains \(n\) space-separated integers, representing the elements of the array.
  3. The third line contains a single integer representing the \(target\) value.

outputFormat

Output to standard output two space-separated integers representing the indices of the two numbers that add up to \(target\).

## sample
4
2 7 11 15
9
0 1