readings: integers that may be negative. Find the reading closest to zero and return it.
If several readings are equally close (say, -3 and 3), return the largest of them.readings=[-6, 3, -2, 9] → -2
-2 is closest to zero, at distance 2; 3 is at distance 3.
readings=[-5, 5, 8] → 5
-5 and 5 are equally far from zero, so the larger one, 5, wins.
readings=[0, -1] → 0
readings=[-6, 3, -2, 9]
-2
Run checks the first 3 tests in your browser. Submit checks all 130 tests on the server, hidden ones included.