Problem
A broken calculator shows start_value and has only two buttons: double the number, or subtract 1. Return the minimum number of presses to show target.
Example 1
- Input
- start_value = 2, target = 3
- Output
- 2
- Why
- double, then subtract: 2 → 4 → 3
Example 2
- Input
- start_value = 5, target = 8
- Output
- 2
- Why
- subtract, then double: 5 → 4 → 8
Example 3
- Input
- start_value = 3, target = 10
- Output
- 3
- Why
- 3 → 6 → 5 → 10
Constraints
1 <= start_value, target <= 10^9