Python set and dictionary commented!
\ndef avoidFlood(self, rains: List[int]) -> List[int]:\n        # We just need to know if there are zeros in between two lakes\n        # so that it can be drie
```\ndef avoidFlood(self, rains: List[int]) -> List[int]:\n        # We just need to know if there are zeros in between two lakes\n        # so that it can be dries otherwise return []\n        # O(N^2) is easy after we index the zeros and the lakes in a dic\n        # Maybe use a heap for instead of the set to store the indices of\n        # Storing the most information that we can is the key to solving the\n        # question so that we can later use that situation.\n        dic = {}\n        set_ = set()\n        ans = [-1 for _ in range(len(rains))]\n        for i in range(len(rains)):\n            if rains[i] == 0:\n                set_.add(i)\n            else:\n                if rains[i] not in dic:\n                    dic[rains[i]] = i\n                    ans[i] = -1\n                else:\n                    # Need to find an empty spot for this lake that is \n                    # after its index which was in the dictionary\n                    index = dic[rains[i]]\n                    flag = 0\n                    for item in set_:\n                        if item > index:\n\t\t\t\t\t\t# dry this lake on this zero\n                            ans[item] = rains[i]\n\t\t\t\t\t\t# Update the location of this lake for future if it needs to be dried\n                            dic[rains[i]] = i\n\t\t\t\t\t\t# Can\'t use this zero to dry up other lakes remove it.\n                            set_.remove(item)\n                            flag = 1\n                            break\n                            \n                    if flag == 0:\n                        # didn\'t find and empty spot to empty this lake\n                        return []\n            # convert the extra zeros into 1\'s we don\'t need them for \n            # drying up any lake\n            if rains[i] == 0 and ans[i] == -1:\n                ans[i] = 1\n        return ans\n\n```
[]