From 6e4342c1de25e0e65cefd7c530686a79955c9cbc Mon Sep 17 00:00:00 2001 From: SanuraagM <21D180037@iitb.ac.in> Date: Mon, 10 Oct 2022 22:27:22 +0530 Subject: [PATCH 1/2] modified sub-array --- Symphony/subarray_sum.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Symphony/subarray_sum.cpp b/Symphony/subarray_sum.cpp index e2df6f2..7ca7030 100644 --- a/Symphony/subarray_sum.cpp +++ b/Symphony/subarray_sum.cpp @@ -7,12 +7,21 @@ int max_subarray_sum(int *array, int n) { // Go through all possible subarays // Maintain a maximum of their sum, return the maximum int best_sum = 0; + int sum_of_this_subarray = 0; + int ender=1; for (int i=0; i Date: Fri, 21 Oct 2022 04:22:55 +0530 Subject: [PATCH 2/2] Update auction.cpp --- Sorting and Searching/Auction/auction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sorting and Searching/Auction/auction.cpp b/Sorting and Searching/Auction/auction.cpp index ab8e6b5..d153260 100755 --- a/Sorting and Searching/Auction/auction.cpp +++ b/Sorting and Searching/Auction/auction.cpp @@ -35,7 +35,7 @@ int main(){ int boughtIndex = getMinIndex(price); // Index with minimum price for(int j = 0; j < n; j++){ - if(price[j] > price[boughtIndex] && !bought[boughtIndex] && price[j] <= customer[i]){ + if(price[j] > price[boughtIndex] && !bought[j] && price[j] <= customer[i]){ boughtIndex = j; } } @@ -64,4 +64,4 @@ int main(){ cout << customer[i] << " "; } -} \ No newline at end of file +}