Skip to content

Commit 26239f9

Browse files
committedJul 27, 2018
Refactor dynamic programming approach of Trapping Rain Water problem.
1 parent f07e96e commit 26239f9

File tree

1 file changed

+1
-1
lines changed
  • src/algorithms/uncategorized/rain-terraces

1 file changed

+1
-1
lines changed
 

‎src/algorithms/uncategorized/rain-terraces/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ the sides minus its own height.
7474

7575
- Initialize `answer = 0`
7676
- Iterate the array from left to right:
77-
- Initialize `max_left = 0 and `max_right = 0`
77+
- Initialize `max_left = 0` and `max_right = 0`
7878
- Iterate from the current element to the beginning of array updating: `max_left = max(max_left, height[j])`
7979
- Iterate from the current element to the end of array updating: `max_right = max(max_right, height[j])`
8080
- Add `min(max_left, max_right) − height[i]` to `answer`

0 commit comments

Comments
 (0)
Please sign in to comment.