Build an array where each index i contains the maximum height from the start of the array to that index. This array helps determine the maximum height of water that can be trapped on the left side of each tower.
Right Max Array:
Similarly, construct an array from the right where each index i contains the maximum height from the end of the array to that index. This indicates the potential maximum height of water that can be trapped on the right side of each tower.
Water Trapping Calculation:
With both arrays constructed, the amount of water trapped above each tower can be calculated by determining the minimum of the left and right maximum heights at that index (since water can only be as high as the shorter "wall" on either side) and then subtracting the height of the tower itself.