Is anyone having zio 2021 Q12 solution
24 is the answer
I don’t remember the question (something like convert(11, *******, 2)) but the answer is 24.
We can backtrack from y to x, inverting the operations [subtract 1, multiply by k] to [add 1, divide by k] and moving towards x giving us the most optimal answer.
- If y is divisible by k, y := y/k
- If not, y := y+1
- Add 1 to answer
- Repeat till y = x