You may open or close any of the walls between adjacent tanks. If any walls are open, then the amount of water in all the connected tanks will equalize. Assume that they equalize fast enough that you can't close walls in the middle of the process. You may have multiple walls open at once. For example, if you open all the walls, then each tank will have 10/9 gallons in it.
Your task, should you choose to accept it, is to open and close walls in such an order that you drain as much water out of the filled tank as you can. What's the best you can do?
See the solution