#K72077. Find Two Sum Indices
Find Two Sum Indices
Find Two Sum Indices
Problem Description: Given an array of integers and a target sum, find two distinct indices \(i\) and \(j\) such that \(arr[i] + arr[j] = target\). If such a pair exists, output the two indices (0-indexed) separated by a space. If there are multiple answers, output the first valid pair found. If no such pair exists, output "None".
Constraints: The array length can be large (up to \(10^5\) elements), so an efficient solution is required.
inputFormat
Input Format:
- The first line contains an integer \(n\), the number of elements in the array.
- The second line contains \(n\) space-separated integers representing the array elements.
- The third line contains an integer \(target\), the target sum.
outputFormat
Output Format:
- If a valid pair is found, output the two indices (0-indexed) separated by a space.
- If no such pair exists, output "None".
4
2 7 11 15
9
0 1