← Discussions on Number of 1 Bits
I imran.n
10 Aug 2026, 17:17

Intuition + complexity breakdown for Number of 1 Bits.

XOR cancels equal numbers, and x & (x - 1) clears the lowest set bit. Both give O(1) space solutions here.

1 reply

likhitha.c 2 months ago

Same idea, but I used a deque. Works fine.

Sign in to reply.