Trains the technique from
LeetCode 66Plus OneThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A turnstile keeps its running count on a row of mechanical drums, one digit per drum. The array digits reports what the drums currently show, with digits[0] sitting at the far left of the row.
One more person walks through, so the counter ticks up by a single step. A drum showing nine wraps back to zero and nudges the drum to its left; when the leftmost drum wraps, the housing exposes a fresh drum in front of it that now shows one. Give back the drum readings after the tick.
Example 1
The rightmost drum has room to climb, so nothing else on the row moves.
Example 2
The rightmost drum wraps to zero and nudges its neighbour from six to seven.
Example 3
Every drum wraps, so the housing exposes a new drum in front showing one.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def plus_one(digits: list[int]) -> list[int]:public int[] plusOne(int[] digits)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.