Skip to content

Commit 498ab10

Browse files
Repeated Math operation (trekhleb#584)
Co-authored-by: Oleksii Trekhleb <[email protected]>
1 parent bbe0462 commit 498ab10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/algorithms/uncategorized/rain-terraces/bfRainTerraces.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function bfRainTerraces(terraces) {
2525
if (terraceBoundaryLevel > terraces[terraceIndex]) {
2626
// Terrace will be able to store the water if the lowest of two left and right highest
2727
// terraces are still higher than the current one.
28-
waterAmount += Math.min(leftHighestLevel, rightHighestLevel) - terraces[terraceIndex];
28+
waterAmount += terraceBoundaryLevel - terraces[terraceIndex];
2929
}
3030
}
3131

0 commit comments

Comments
 (0)