WORLD 8

BITS AND MATH

Treat a number as a row of switches: cancel pairs with XOR, clear bits one at a time.

STAGE 0 Bits and math tutorial

0:00 / 0:00

The move

Treat every number as a row of switches. XOR cancels pairs (x ^ x = 0), x & (x - 1) clears the lowest set bit, and shifts double or halve. Math tricks like sums and repeated squaring replace whole loops.

Spot it
Every number appears twice except one, count the 1 bits, power of two, no extra space, or a huge exponent.
Cost
Each bit operation is one step on a fixed-width number, so one pass is O(n) time and O(1) space.

15 STAGES Bits and math problems

☆☆☆☆☆ Clear 5 to finish this world.