target and a starting number x that you pick yourself. A single move changes both numbers: x goes up or down by 1, and at the same time target goes up or down by 1.
Using at most moves moves, you must make x and target equal (if they are equal from the start, no moves are needed).
Return the largest starting x for which this is possible.target=5, moves=2 → 9
Start at 9. Move one: 9 → 8 and 5 → 6. Move two: 8 → 7 and 6 → 7. They match. From 10 or more, two moves are not enough.
target=1, moves=1 → 3
From 3 in one move: 3 → 2 and 1 → 2.
target ≤ 50moves ≤ 50target=5, moves=2
9
Run checks the first 3 tests in your browser. Submit checks all 84 tests on the server, hidden ones included.