update trapping_rain_water from O(n) space to O(1) space