Number of steps

ques-https://hack.codingblocks.com/app/practice/5/1038/problem
code-
https://ide.codingblocks.com/s/378089

hey @aaliyah_beg what is your doubt ?

Sir, may you please point out the error in my code as it fails to give the right output

hey @aaliyah_beg in this question just count the number of setbits in the particular test case .
that will be the answer for your query .
cout<<_builtin__popcount(n); this is your answer .
Happy Learning !!

okay sir but why isn’t this logic working?

i havent checked that .i saw your code and understood that your code is way too different and complicated .
thats why i told you the optimized approach .
do you want me to check your code ?

yes , sir please check.

@aaliyah_beg wait , i am checking

@aaliyah_beg could you please explain your logic .
i wll be able to correct you in the better way .

code –https://ide.codingblocks.com/s/378203, sir I have tried explaining

Sir, I found the error and now its running properly. Thank

hey @aaliyah_begif you feel that your doubt is cleared please mark this doubt as resolved .
Happy Learning !!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.