You are given two integers X and Y,
in one move you can select an integer j(0<=j<=60) and set X=X-pow(2,j)-Y,
find minimum moves to make X equal to 0, if it is not possible return -1.
Example Test Case:
8 -3:
ans:3
X=8-1-(-3)=10
X=10-8-(-3)=5
X=5-8+3=0
so total 3 moves,
i tired greedy by looking for power of two just lower than x-y and subtracting it from x , but it did not work.
Any approach?