#C12233. Find Pair With Sum

    ID: 41638 Type: Default 1000ms 256MiB

Find Pair With Sum

Find Pair With Sum

You are given an array of integers and a target integer. Your task is to find two distinct indices (i) and (j) such that (nums[i] + nums[j] = target) holds true. If such a pair exists, output the pair of indices (0-indexed) corresponding to the first valid occurrence. Otherwise, output "None". This problem tests your ability to implement efficient lookup techniques.

inputFormat

The input is given via stdin and consists of three lines:

  1. The first line contains an integer (n), representing the number of elements in the array.
  2. The second line contains (n) space-separated integers denoting the array elements.
  3. The third line contains an integer (target), the target sum to find.

outputFormat

Output a single line to stdout. If a valid pair is found, print the two indices separated by a space. If no such pair exists, print "None".## sample

4
2 7 11 15
9
0 1

</p>