← All problemsSign in

Bitsy

Given a positive integer number $N$ and non-negative integer $K$. A conversion can be applied to $N$ that has two parts described as: 1. First the bits from the rightmost set bit till the end are flipped. 2. Then $K$ is subtracted from the above new number. You need to tell the smallest non-negative number that will be left if the above conversion is applied repeatedly and also the number o

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