Trains the technique from
LeetCode 2553Separate the Digits in an ArrayThis 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 cloakroom board shows ticket codes on a long strip of cells, one digit per cell.
The board works through codes from the first entry to the last. For each code it fills the next few cells with that code's digits, taken left to right as the code is written, and then carries straight on with the code after it. Nothing separates one code from the next on the strip.
Return the digits in the cells, in the order the board filled them.
Example 1
The board fills 4, 0, 2, 1 for the first code, then a single cell with 7, then 1, 0, 0, 0, 0, 0 for the third code, then 6, 0, 5 for the last.
Example 2
Reading the strip back gives 8, 6 then 4 then 5, 1, 7 then 2, 0, which is each code's digits in writing order with the codes still in their original order.
Example 3
One code fills four cells, and the two zeros in the middle of the code each take a cell of their own.
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 digit_cells(codes: list[int]) -> list[int]:public int[] digitCells(int[] codes)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.