← All problemsSign in

Varad and Game of Bits

Varad likes to play alot of games involving numbers. He defines one as follows. He gives his rival Abizer a number N and asks him to convert it into its binary representation. As it is Varad's game, he always starts. He chooses any two consecutive bits and performs any one of the following operations: 1. Bitwise OR(|) 2. Bitwise AND(&) The two selected bits are replaced by the result of the ope

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start