Challenge: Find the Closest Number
Find the closest number to a given number in an array.
We'll cover the following
Closest number
In any given sorted list, the closest number to a given number is the one whose absolute difference with the given number is closest to zero.
Have a look at the following illustration for a better understanding:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.