mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 07:01:18 +08:00
Update README for Trapping Rain Water problem.
This commit is contained in:
parent
26239f9a97
commit
f1152bf4b4
@ -109,9 +109,12 @@ The concept is illustrated as shown:
|
||||
|
||||
**Complexity Analysis**
|
||||
|
||||
Time complexity: `O(n)`.
|
||||
Time complexity: `O(n)`. We store the maximum heights upto a point using 2
|
||||
iterations of `O(n)` each. We finally update `answer` using the stored
|
||||
values in `O(n)`.
|
||||
|
||||
Auxiliary space complexity: `O(n)` extra space.
|
||||
Auxiliary space complexity: `O(n)` extra space. Additional space
|
||||
for `left_max` and `right_max` arrays than in Approach 1.
|
||||
|
||||
## References
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user