← Questions
Pour water onto a terrain
0
I was asked this
No reports yet. Sign in to say where you were asked it.
An array gives the height of each column of a terrain.
- Print the terrain.
- Drop a given number of water units at a column, one at a time. Each unit moves left if it can eventually fall lower that way, else right, else it stays where it is and raises the level there. Print the terrain with the water.
Make the movement rules exact before coding, and keep the printing code separate from the simulation.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
