Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Swim in Rising Water

An n x n grid holds a permutation of 0..n^2-1 as elevations. At time t you can swim into any cell with elevation <= t, moving 4-directionally with no cost. Print the least time needed to reach the bottom-right cell from the top-left one.

Constraints

1 <= n <= 50

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.