LeetCode
Swim in Rising Water
Click
here
for an explanation.