In this case, we do get the right result. But such algorithm needs to be careful that what if the number closest to 20 but less than it is 19.5 instead of 11? After we find the number, we still need to check the neighbors
In this case, we do get the right result. But such algorithm needs to be careful that what if the number closest to 20 but less than it is 19.5 instead of 11? After we find the number, we still need to check the neighbors