← All problemsSign in

1488. Avoid Flood in The City

LeetCodeArrayHash TableBinary SearchGreedyHeap (Priority Queue)Open on judge ↗

Your country has 109 lakes. Initially, all the lakes are empty, but when it rains over the nth lake, the nth lake becomes full of water. If it rains over a lake that is full of water, there will be a flood. Your goal is to avoid floods in any lake. Given an integer array rains where: - rains[i] > 0 means there will be rains over the rains[i] lake. - rains[i] == 0 means there are no rains this d

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start