As per question, Input: [1, 3, 5, 4, 1]
and answer is give as 6, which is between 3-4.
But from the graph, between 3-5, 3 levels of water can be stored and between 5-4, 4 levels of water can be stored, so the answer should be 7. Am I missing something here?
Also question needs to be rephrased because water level between first and last building will always be the maximum. Again am I missing something here too!