Watch out for important notes in the problem


The indexes returned are not zero based… “Please note that your returned answers (both index1 and index2 ) are not zero-based.” . So if the solution turns out to be at indexes 0 and 4, the indexes to be returned are 1 and 5.

Second note - If multiple solutions exist, output the one where index2 is minimum . If there are multiple solutions with the minimum index2 , choose the one with minimum index1 out of them… This restricts to return solutions with minimum indexes… Thats the first pair indexes which sum to target.