values that contains no zeros. Find the largest positive number k such that -k also appears in the array.
Return that k. If there is no such number, return -1.values=[5, -2, 8, 2, -5, 3] → 5
Both 2 and 5 have their opposites in the array; 8 and 3 do not. The larger one is 5.
values=[4, 6, -1, -3] → -1
No positive number has its negative counterpart, so the answer is -1.
values=[-9, 9] → 9
values=[5, -2, 8, 2, -5, 3]
5
Run checks the first 3 tests in your browser. Submit checks all 115 tests on the server, hidden ones included.