Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Zigzag Array by MBM_1607
from typing import List
def create_zigzag(rows: int, cols: int, start: int = 1) -> List[List[int]]:
zigzag = [[start + row * cols + col for col in range(cols)] for row in range(rows)]
return list(map(lambda x: list(reversed(x)) if zigzag.index(x) % 2 else x, zigzag))
April 4, 2020