From bceb429910bd16e0bf1e5ec88a03e481821ef5c6 Mon Sep 17 00:00:00 2001 From: nsharma89 <71920486+nsharma89@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:56:55 +0530 Subject: [PATCH] Update max-sum.cpp Converted to Minimum Sum Solution --- max-sum.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/max-sum.cpp b/max-sum.cpp index d8c8b72..4aa3119 100644 --- a/max-sum.cpp +++ b/max-sum.cpp @@ -10,9 +10,9 @@ for (int a = 0; a < n; a++) { int sum = 0; for (int b = a; b < n; b++) { sum += arr[b]; -best = max(best,sum); +best = min(best,sum); } } -cout<<"The maximum sum of the elements is "<