Broken Calculator
A calculator supports two buttons: DOUBLE (x → 2x) and DECREMENT (x → x−1). Print the minimum presses to turn A into B.
Input: one line with two integers A and B.
Output: the minimum number of button presses.
Constraints:
- 1 ≤ A, B ≤ 1018
Sample Tests
Input 1
2 3
Output 1
2
Input 2
5 8
Output 2
2
Discussion (opens after you solve — no spoilers before)
No comments yet.