LeetCode solutions

3708. Zigzag Grid Traversal With Skip

My accepted Python solution to LeetCode problem 3708, Zigzag Grid Traversal With Skip, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.9MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.9MB, accepted 2026-01-01.

python
class Solution:
    def zigzagTraversal(self, grid: List[List[int]]) -> List[int]:
        result = []
        skip = False
        for i, row in enumerate(grid):
            if i % 2 == 1:
                row = row[::-1]
            for val in row:
                if not skip:
                    result.append(val)
                skip = not skip
        return result

Source