From 3fc9dddd9ae04cdfe8b3957e77fd478b3693c7cb Mon Sep 17 00:00:00 2001 From: Johnathan Jacobs Date: Wed, 8 Jan 2025 15:07:53 +0100 Subject: [PATCH] fix two-pointers calculateMaxArea --- content/wiki/algorithms/searching/two-pointers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/wiki/algorithms/searching/two-pointers.md b/content/wiki/algorithms/searching/two-pointers.md index 2ce389a..309bd4d 100644 --- a/content/wiki/algorithms/searching/two-pointers.md +++ b/content/wiki/algorithms/searching/two-pointers.md @@ -148,13 +148,13 @@ move the pointer pointing to the shorter line inward to try and find a taller li if (lHeight < rHeight) { ++left; } else { - ++right; + --right; } } return maxArea; } int main() { - return calculateMaxArea({0, 10, 0, 5, 0}) == 50 ? 1 : 0; + return calculateMaxArea({0, 10, 0, 5, 0}) == 10 ? 1 : 0; } ```