#K83992. Two Sum Indices Finder

    ID: 36320 Type: Default 1000ms 256MiB

Two Sum Indices Finder

Two Sum Indices Finder

This problem is a classic algorithm challenge. You are given an array of integers and an integer target. Your task is to find two distinct indices i and j such that \(a_i + a_j = \) target. It is guaranteed that there exists exactly one solution for each test case. The answer must be printed to standard output in ascending order (i.e. the smaller index first).

Input: The first line contains an integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers representing the array. The third line contains an integer representing the target value.

Output: Output the two 0-indexed positions in ascending order, separated by a space.

inputFormat

The input is read from standard input (stdin):

  • The first line contains an integer \(n\), the number of elements.
  • The second line contains \(n\) space-separated integers.
  • The third line contains an integer, the target value.

outputFormat

Print the two indices (0-indexed) that add up to the target, separated by a space in ascending order.

## sample
4
2 7 11 15
9
0 1