Playing with bits

Timelimit exceede error coming

hey, @sulbh579 if you check every number for every test case it will give you TLE,an optimized logic would be like this:
1.for every i from n to m intitialize x =0 ;
2. store i in a temp and while(temp!=0) Do bitwise & of temp with (temp-1) and assign the value back to temp as
temp = temp&(temp-1) and increment x by 1

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.