target with the value each counter must show at the end, return the fewest presses needed to reach exactly target.target=[3, 4] → 5
[0, 0] → +1 on the second: [0, 1] → double: [0, 2] → +1 on the first: [1, 2] → double: [2, 4] → +1 on the first: [3, 4]. Five presses in total.
target=[0, 0, 7] → 5
[0, 0, 1] → double → [0, 0, 2] → [0, 0, 3] → double → [0, 0, 6] → [0, 0, 7]: three bumps and two doublings.
target=[8] → 4
One bump and three doublings: 1 → 2 → 4 → 8.
target=[3, 4]
5
Run checks the first 3 tests in your browser. Submit checks all 99 tests on the server, hidden ones included.