N*(n-1) approach of calculating the no. of set bits in the number

i cant get the approach as i found a wrong representation of 10 in the video also i have a doubt in this concept so can you please help.?

I think you mean n&(n-1) approach

concider 11 => 1011
n-1 i.e 10 => 1010
n&(n-1) = 1010

concider 14 => 1110
n-1 i.e 13 => 1101
n&(n-1) = 1100

you can see whenever you subtract 1 from a number rightmost set bit breaks, and then when you & it with (n-1) only remaining bits will be there

if you are able to do this x number of time, before number becomes 0, it means there are x set bits

Hi Aman, since you have not been responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.