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 "<