value. In one step you may add any power of two (1, 2, 4, 8, and so on) to it, or subtract one from it.
Return the smallest number of steps needed to turn value into 0.value=23 → 3
23 + 1 = 24, 24 + 8 = 32, 32 − 32 = 0: three steps. Two steps are not enough.
value=12 → 2
12 − 4 = 8, then 8 − 8 = 0: two steps.
value=64 → 1
value=23
3
Run checks the first 3 tests in your browser. Submit checks all 58 tests on the server, hidden ones included.