#C14168. Find Pair with Target Sum
Find Pair with Target Sum
Find Pair with Target Sum
Given a list of integers and a target integer, your task is to find two distinct indices such that the corresponding numbers in the list add up to the target.
If such a pair exists, output their indices (0-indexed) separated by a space. Otherwise, output None
.
Note: If there are multiple valid pairs, return the first one found when scanning the list from left to right.
inputFormat
The input is given from standard input (stdin). The first line contains two integers, n and target, where n is the number of integers in the list. The second line contains n space-separated integers representing the list.
outputFormat
Output the indices of the two numbers (0-indexed) separated by a space if such a pair is found, or output 'None' if no valid pair exists.## sample
4 9
2 7 11 15
0 1