Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
range solution in Clear category for Zigzag Array by mlahor
from typing import List
def create_zigzag(rows: int, cols: int, start: int = 1) -> List[List[int]]:
retl = []
for i in range(rows):
l = [*range(start,start+cols)]
retl.append(sorted(l,reverse=bool(i%2)))
start+=cols
return retl
March 29, 2021
Comments: