What should be the Maximum height in each test case?

Apoorva has created an elevated roof. She wants to know how much water can she save during rain.

Given n non-negative integers representing the elevation map where the width of every bar is 1, Find the maximum water that she can save.

But what should be the maximum height in each test case? Like in this maximum height is 2

@iamlovelesh
If a wall greater than or equal to the previous wall is encountered then make note of the index of that wall in a var called prev index. Keep adding previous wall’s height minus the current (ith) wall to the variable water. Have a temporary variable that stores the same value as water. If no wall greater than or equal to the previous wall is found then quit.