Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Such a solution would pass the tests and be more efficient.
But it wouldn't be correct by the requirements: "Return None if it is not possible to define only one of such values".
So if the array is
[5, 3, 3, 1]
we should return 1 as closest to zero and we can only do that if we cover the whole array.If we stop for any number at equal distance to the current closest to zero we would stop for 3 and return None.
It's what dinglemouse complains about at my first solution that did what you suggested.