Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Generator solution in Clear category for Duplicate Zeros by Krischtopp
from collections.abc import Iterable
def duplicate_zeros(donuts: list[int]) -> Iterable[int]:
for donut in donuts:
yield donut
if donut == 0:
yield donut
Oct. 19, 2023