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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17.9MB, accepted 2026-01-01.
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