#K35497. Find Pair Indices

    ID: 25544 Type: Default 1000ms 256MiB

Find Pair Indices

Find Pair Indices

You are given an array arr of n integers and a target integer T. Your task is to find two distinct indices i and j such that the sum of the corresponding elements equals the target; that is, \( arr[i] + arr[j] = T \). If such a pair cannot be found, output an empty list (i.e., []).

Note: The indices are zero-based. It is guaranteed that if a solution exists, then it is unique.

inputFormat

The input is read from standard input (stdin) and consists of three lines. 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 elements. The third line contains an integer representing the target sum T.

outputFormat

Output to standard output (stdout) two space-separated indices of the numbers in the array that add up to the target value. If no valid pair exists, output an empty list: []## sample

4
2 7 11 15
9
0 1