#K54972. Two Sum Problem

    ID: 29872 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

You are given an array of integers nums and an integer target. Your task is to find two distinct indices i and j such that:

$$nums[i] + nums[j] = target$$

It is guaranteed that the answer exists and that there is exactly one solution. You may not use the same element twice.

Input Format: The first line contains an integer n representing the number of elements in nums. The second line contains n space-separated integers representing the elements of nums. The third line contains an integer target.

Output Format: Print two integers in one line separated by a single space, representing the indices of the two numbers that add up to the target.

inputFormat

The input is read from stdin:

  • The first line contains an integer n (the size of the array).
  • The second line contains n space-separated integers denoting the array nums.
  • The third line contains an integer target.

outputFormat

Output to stdout. Print the two indices in a single line separated by a space that satisfy the condition.

## sample
4
2 7 11 15
9
0 1

</p>