← Discussions on Reverse Bits
A aditimenon OFFICIAL
11 Sep 2026, 14:47

Why does my solution TLE on the last test case?

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

2 replies

kunalsax8 1 month ago

You can avoid the extra array and do it in O(1) space.

farhan_63 1 month ago

You can avoid the extra array and do it in O(1) space.

Sign in to reply.