Sobes.tech
Intern — Senior

Finding a pair of numbers with zero sum in an array

livecode

Task condition

Implement the function findTwo that takes an array of integers and returns the indices of two elements whose sum is zero.

 // findTwo([1, 2, 3, -1])    // [0, 3]
// findTwo([1, 2, 3, -1, -2, 0])    // [1, 4] or [0, 3]
// findTwo([1, 2, 3, 4])    // null