Skip to main content

Swim in Rising Water

Given n x n grid where grid[i][j] is elevation at (i,j) At time t, can swim if elevation <= t Find minimum time to reach bottom-right from top-left Example: grid = [[0,2],[1,3]] => 3

Swim in Rising Water is really a boundary-finding problem, even if it doesn't look like it at first. It's a hard one for a reason: it stresses boundary precision when the rules pile up. If you can state the invariant for your search space, you'll stop making off-by-one mistakes.

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.

1Find Minimum Time to Reach Destinationhard
Based onLeetCode

Get a note when something new lands

New company guides, new problems and big changes to Coco. Rare, and you can leave any time. By joining you agree to get these emails.