← Discussions on Number of 1 Bits
A aarav.m
16 Jun 2026, 06:36

Finally got AC after 3 WAs. Sharing what I missed.

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

1 reply

srinivasiye5 3 months, 4 weeks ago

Nice. Got asked a variant of this in an interview.

Sign in to reply.