Swim in Rising Water · Compound Engineer

Swim in Rising Water

Cross a grid while the water rises, so a path costs its tallest cell. Why a priority queue that always steps onto the lowest reachable cell finds the earliest moment you can swim across, and how Union-Find gets there another way.

DSAProHardStep-through playerBy Aayush OstwalSolve on LeetCode ↗
Spotted a mistake in this lesson?Report an issue →