https://ide.codingblocks.com/s/253044 can u tell me why my code is wrong and plz suggest me a right way to solve it
Incredible hulk
you have misunderstood the problem so what you need to do is find the minimum powers of 2 whose sum leads to n i can explain better with examples
eg 1:-
3
3= 2+1 which is 2^1+2^0
so ans=2;
eg2
4
4 =2^2
so ans=1
eg 3
17
15= 2^0+2^1+2^2+2^3
so all you need to find in this question is number of set bits in the binary representation of the n
correct code :-
In case of any doubt feel free to ask 
mark your doubt as resolved if you got the answer
1 Like
Okay sir my doubt is clear i will try to code