Final — B: The Vault Clock
Challenge on lesson: Final-B: The Vault Clock
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** A vault door shows a 4-digit display (0000..9999). Each second
you may press one of two buttons: +1 or -1 on the LAST digit (wrapping: 9+1=0,
0-1=9). Given the current display and the target display, print the minimum
number of seconds.
**Input:** Line 1: t (1 <= t <= 100000). Next t lines: two 4-digit strings cur
and target.
**Output:** t lines: the minimum presses for each case.
**Example:** 1 / 1234 1230 -> 4 (press -1 four times on the last digit).
Press Submit to check your solution.
Back to lesson: Final-B: The Vault Clock