Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 26239f9

Browse files
committed
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‎

Lines changed: 1 addition & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /