I need some help for solving this problem. I need to write a function that fills seats in a theater. For example we have this theater:
theater = [ [1, 1, 1, 0], # 1 row
[1, 0, 1, 0], # 2 row
[0, 0, 0, 0], # 3 row
]
We have to fill the seats from the beginning of the row.
First, we have to fill the row with least filled seats.
If we have 2 rows with equal number of filled seats we fill the one with lower row number (we have to fill row 2 if it has the same number of filled seats as row 3).
Finally, we have to fill till all the seats are filled.
Empty seats are 0 and filled ones - 1.
The result has to be list of tuples - first element will be row's number and the second one - column's number - (2,1) - row #2 and column #1 for example.
Example:
theater = [ [1, 1, 1],
[1, 0, 0],
[1, 0, 0],
[1, 1, 0] ]
expected = [(4, 3), (2, 2), (2, 3), (3, 2), (3, 3)]