I'm currently trying to improve my algorithm skills and I was trying a simple algorithm :
Given a list of integers. We want to find the one that is the closest to 0. If we have a number and his opposite, we want to return the positive one.
My current complexity on this algorithm is O(n). Is it possible to get a lower one ?
My current solution looks at all the values. I was thinking about a binary search, but we're not looking for a specific number, and the list of integers is not sorted.
Thanks for the help !