Question has errors
The question says to return any answer in case multiple correct answers available but it isn\'t accepting.\nFor Eg testcase [69,0,0,0,69]\nMy ans is [-1,1,1,69,
The question says to return any answer in case multiple correct answers available but it isn\'t accepting.\nFor Eg testcase [69,0,0,0,69]\nMy ans is [-1,1,1,69,-1] which it isn\'t accepting \nBut accepts [-1,69,1,1,-1].\n\nMy Code:\nclass Solution {\npublic:\n    vector<int> avoidFlood(vector<int>& rains) {\n        int i,n=rains.size();\n        vector<int> v(n,-1);\n        vector<int> d;\n        unordered_map<int,int> h;\n        \n        for(i=0;i<n;i++)\n        {\n        if(rains[i]==0)\n        d.push_back(i);\n        \n        else if(h[rains[i]]==1)\n        {\n             if(d.size()==0)\n            return {};\n            else\n            {\n            h[rains[i]]--;\n            v[d.back()]=rains[i];\n            d.pop_back();\n            }\n        }  \n            \n        else\n        h[rains[i]]++;\n        }\n        \n        return v;\n        \n    }\n};\n
[]