#C12233. Find Pair With Sum
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:
- The first line contains an integer (n), representing the number of elements in the array.
- The second line contains (n) space-separated integers denoting the array elements.
- 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>