From f1152bf4b49dd81dc7cbbe80b575deb89a88e2a9 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Fri, 27 Jul 2018 14:11:33 +0300 Subject: [PATCH] Update README for Trapping Rain Water problem. --- src/algorithms/uncategorized/rain-terraces/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/algorithms/uncategorized/rain-terraces/README.md b/src/algorithms/uncategorized/rain-terraces/README.md index 5907ed6d..cb59346b 100644 --- a/src/algorithms/uncategorized/rain-terraces/README.md +++ b/src/algorithms/uncategorized/rain-terraces/README.md @@ -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