ByteDance / TikTok logoByteDance / TikTok
Coding·60 minMembers

Longest Zigzag Path in a Grid

Members only

TT Ads phone screen. Given an integer grid, return the length of the longest path (4-directional moves) whose consecutive value comparisons strictly alternate — grid[a] < grid[b] > grid[c] < ... or th...

SWE
grid
dfs
backtracking
dp
medium
Frequency
Single report
Last asked
2026-06-17
Stage
phone-screen

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...