Trains the technique from
LeetCode 2Add Two NumbersThis 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 workshop logs mileage counters onto punched paper tapes. A tape is a one-way chain of cells: every cell holds a single digit and links to the cell punched after it, and the final cell links to nothing. The punch head starts at the smallest place value, so the front cell of a tape carries the ones digit, the cell after it carries the tens digit, and so on.
Because the harness passes plain JSON, each tape arrives as an array of its digits in punch order, ones digit at index 0. You get two of them, left and right. Neither tape is empty, and neither carries useless high-order padding: the last cell of a tape is nonzero unless the whole tape is a single 0.
Return the tape that records the sum of the two counter values, laid out the same way: an array of digits with the ones digit first. Produce it cell by cell while stepping through both chains together and pushing any overflow into the next place. Do not fold either chain into one big number before adding.
Example 1
The tapes record 486 and 37. Adding the ones cells gives 13, so the answer's front cell is 3 and 1 rides into the tens place, where 8 + 3 + 1 = 12 leaves 2 and another rider, and 4 + 1 = 5 finishes the hundreds place.
Example 2
995 plus 18 is 1013. The overflow survives past the end of both tapes, so the answer needs one more cell than the longer input.
Example 3
A counter sitting at zero is punched as a single 0 cell, and adding it leaves 74 untouched.
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 sum_odometer_tapes(left: list[int], right: list[int]) -> list[int]:public int[] sumOdometerTapes(int[] left, int[] right)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.