Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Duplicate Zeros by Pactp
from collections.abc import Iterable
def duplicate_zeros(donuts: list[int]) -> Iterable[int]:
def duplicate_0(donuts: list[int]):
for n in donuts:
if n == 0: yield n
yield n
return list(duplicate_0(donuts))
March 15, 2023