#K51042. Two Sum Pair Indices
Two Sum Pair Indices
Two Sum Pair Indices
Given an array of integers and a target integer \(T\), your task is to find two indices \(i\) and \(j\) (0-indexed) such that \(nums[i] + nums[j] = T\). If there are multiple valid pairs, return the first pair found according to the array order. If no such pair exists, output -1.
The input is provided via standard input (stdin) and the output should be sent to standard output (stdout) in the format specified below.
inputFormat
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 \(nums\). The third line contains a single integer \(T\), the target value.
outputFormat
If a valid pair is found, output the two indices separated by a space. Otherwise, output -1.
## sample4
2 7 11 15
9
0 1