Leetcode 1488. Avoid Flood in The City
Assign dry operations on zero days so that no lake is rained on while already full: given a sequence where rains[i]>0 fills a lake and rains[i]==0 lets you dry one lake, return any schedule of dries that prevents floods or [] if impossible. Core challenge: greedily match available dry days to the next repeat rain for each lake by tracking last-fill times and using an ordered set of zero-day indices to pick a dry before the conflicting rain.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.