One method to tackle this issue involves traversing the array and, for each element, determining the tallest bars on both the left and right sides. The volume of water that the current bar can hold is calculated as the minimum of the maximum heights on either side minus the height of the bar itself. In Python, the implementation might look like this: def findWater ( arr , n ) : # left[i] stores the height of the tallest bar to the left of the i'th bar left = [ 0 ] * n # right[i] stores the height of the tallest bar to the right of the i'th bar right = [ 0 ] * n # Initialize the result variable water = 0 # Populate the left array left [ 0 ] = arr [ 0 ] for i in range ( 1 , n ) : left [ i ] = max ( left [ i - 1 ], arr [ i ]) # Populate the right array right [ n - 1 ] = arr [ n - 1 ] for i in range ( n - 2 , - 1 , - 1 ) : right [ i ] = max ( right [ i + 1 ], arr [ i ]) ; # Compute the total water collected element by element for i in range ( 0 , n ) : water += min ( left [ i ], right [ i ] ) - arr [ i ] return water This method requires O(n) time and O(n) additional space, where n represents the number of elements in the input array.