Company: Applogic networks_Software engineer intern_Oncampus_21july
Difficulty: easy
Given an integer array nums and an integer target , write a program to return the indices of the two numbers such that they add up to target . The original question allows returning any one of the valid index pairs. So that the answer is unique and can be checked automatically, this version asks for a specific one: If several pairs are possible, report the lexicographically smallest pair (i, j) — that is, the pair with the smallest i , and among those the one with the smallest j . Indices are 0-based and the two indices must be different ( i < j ). The same element may not be used twice. Input Format The first line contains an integer n , the length of nums . The second line contains n space-separated integers, the elements of nums . The third line contains the integer target . Output Format Print the two indices i and j (with i < j ) separated by a single space. If no such pair exists, print -1 -1 . Constraints 2 ≤ n ≤ 10 5 -10 9 ≤ nums[i] ≤ 10 9 -2 × 10