#C3606. Find Pair Sum Indices

    ID: 47052 Type: Default 1000ms 256MiB

Find Pair Sum Indices

Find Pair Sum Indices

You are given an array of integers and a target sum. Your task is to find a pair of indices i and j (with i < j) such that the sum of the elements at these indices equals the target.

If such a pair exists, output them in list format as [i, j]. If multiple valid pairs exist, return the first one found. If no such pair exists, output an empty list [].

Mathematically, find indices i and j satisfying:

\( a_i + a_j = target \)

inputFormat

The input is given via standard input (stdin) and consists of two lines:

  • The first line contains space-separated integers representing the array.
  • The second line contains a single integer representing the target sum.

outputFormat

Output the resulting pair of indices in the format [i, j] if such a pair exists. If there is no valid pair, output [].

## sample
2 7 11 15
9
[0, 1]