https://www.codechef.com/problems/BONDFOND Can anyone explain with the help of an example asked 05 Dec, 21:47

The question asks for the minimum absolute difference between a number N and a number A, which is actually a power of 2. Since the minimum difference has been asked, it is obvious that A is the closest number to N that is a power of 2. Do not forget that the number A could be either less than, greater than or even equal to N. For example, if N=5, the nearest power of 2 is 4. For N=3, the nearest powers of 2 are 2 and 4. For N=8, the nearest power of 2 is 8 itself. For N=9, the nearest power of 2 is 8. answered 05 Dec, 23:47

First of all, what is your doubt? you didn't get any idea to solve this question or you don't understand the question? answered 05 Dec, 21:50
