your country infinite number lake Initially lake rain nth lake nth lake water if rain lake water flood your goal avoid flood lakegiven integer array rain whererainsi 0 mean rain rainsi lakerainsi 0 mean rain day choose lake day dry itreturn array ans whereanslength rainslengthansi 1 rainsi 0ansi lake choose dry ith day rainsi 0if multiple valid answer return if impossible avoid flood return arraynotice choose dry lake choose dry lake change Example 1input rain 1234output 1111explanation after day lake 1after second day lake 12after day lake 123after fourth day lake 1234theres day dry lake flood lakeexample 2input rain 120021output 112111explanation after day lake 1after second day lake 12after day dry lake 2 full lake 1After fourth day dry lake 1 there lakesafter fifth day lake 2after sixth day lake 12it easy scenario floodfree 111211 acceptable scenarioExample 3input rain 12012output Explanation after second day lake 12 we dry lake dayafter rain lake 12 its easy prove matter lake choose dry 3rd day flood Constraints1 rainslength 1050 rainsi 109