How to approach this problem ?
Anonymous User
100

An array is given and 2 integers S and D, return the minimum number of moves to convert S into D by using the following operations.If not possible return -1.
x+A[i]
X-A[i]
X xor A[i]

Eg A[ ]={6,2,7,7} , S=10, D=21
Ans is 3 :
S=S+6=16
S=S-2=14
S=S+7=21

Comments (5)