Trains the technique from
LeetCode 1089Duplicate ZerosThis 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 strip of digits reads strip. Every 0 on it is a blank.
Double each blank in place: each 0 becomes two 0s and everything after it shifts one place along. The strip keeps its original length, so whatever is pushed off the end is lost.
Return the strip afterwards.
Example 1
The single blank becomes two, pushing everything along, and the last entry falls off the end.
Example 2
There is no blank anywhere, so nothing moves.
Example 3
The first blank doubles into both places, and the second blank's copies both fall off the end.
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 duplicate_zeros(strip: list[int]) -> list[int]:public int[] duplicateZeros(int[] strip)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.