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 f1152bf

Browse files
committed
Update README for Trapping Rain Water problem.
1 parent 26239f9 commit f1152bf

File tree

1 file changed

+5
-2
lines changed
  • src/algorithms/uncategorized/rain-terraces

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ The concept is illustrated as shown:
109109

110110
**Complexity Analysis**
111111

112-
Time complexity: `O(n)`.
112+
Time complexity: `O(n)`. We store the maximum heights upto a point using 2
113+
iterations of `O(n)` each. We finally update `answer` using the stored
114+
values in `O(n)`.
113115

114-
Auxiliary space complexity: `O(n)` extra space.
116+
Auxiliary space complexity: `O(n)` extra space. Additional space
117+
for `left_max` and `right_max` arrays than in Approach 1.
115118

116119
## References
117120

0 commit comments

Comments
(0)

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