Challenge: Find the Closest Number

In this lesson, you will solve a challenge on finding the closest number to a given number in a sorted array.

Closest number

“In any given sorted array, the closest number to a given number is the one whose absolute difference is closest to zero to the given number.”

Take a look at the following illustration for a better understanding:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.