#K70122. Find Pair with Sum

    ID: 33239 Type: Default 1000ms 256MiB

Find Pair with Sum

Find Pair with Sum

You are given an array of integers and an integer target value. Your task is to find two distinct indices in the array such that the values at these indices add up to the target. If such a pair exists, output the two indices (0-indexed) separated by a space. If no such pair exists, output the string "No Pair Found".

In mathematical notation, given an array \( A = [a_0, a_1, \dots, a_{n-1}] \) and a target \( T \), find indices \( i \) and \( j \) such that:

[ a_i + a_j = T, \quad i \neq j ]

If multiple solutions exist, output the first pair you encounter while processing the array from left to right.

inputFormat

The input is given via standard input (stdin):

  1. The first line contains a single integer \( n \) indicating the number of elements in the array.
  2. The second line contains \( n \) space-separated integers representing the array elements.
  3. The third line contains a single integer representing the target sum \( T \).

outputFormat

The output should be printed to standard output (stdout). If a valid pair is found, print their indices (0-indexed) separated by a single space. If no such pair exists, print the exact string "No Pair Found".

## sample
4
2 7 11 15
9
0 1

</p>