From 498ab10b1b8eb71a4f6c80a62f84cc9c289a40c8 Mon Sep 17 00:00:00 2001 From: vladimirschneider <42021006+vladimirschneider@users.noreply.github.com> Date: Thu, 10 Dec 2020 23:50:47 +0700 Subject: [PATCH] Repeated Math operation (#584) Co-authored-by: Oleksii Trekhleb --- src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js b/src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js index f136e6d4..0d3443a4 100644 --- a/src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js +++ b/src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js @@ -25,7 +25,7 @@ export default function bfRainTerraces(terraces) { if (terraceBoundaryLevel > terraces[terraceIndex]) { // Terrace will be able to store the water if the lowest of two left and right highest // terraces are still higher than the current one. - waterAmount += Math.min(leftHighestLevel, rightHighestLevel) - terraces[terraceIndex]; + waterAmount += terraceBoundaryLevel - terraces[terraceIndex]; } }