Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
... and that's how you use islice. solution in Clear category for Zigzag Array by veky
from typing import List
from itertools import count, islice
def create_zigzag(rows: int, cols: int, start: int = 1) -> List[List[int]]:
it = count(start)
return [list(islice(it, cols))[::(-1)**row] for row in range(rows)]
Oct. 14, 2018
Comments: