I did as stated in the editorial for circular sum subarray. but the answer is not coming.
Maximum Circular Sum editorial doubt
@Subham2107
Just add an endl statement to seperate outputs for each testcase with a new line character.
“Here we can conclude that this algorithm works because it explains the fact the array’s sum could have been maximum if the minimum sum elements sum were not present so we should exclude it.”
"Here we can conclude that this algorithm works because it explains the fact the array’s sum could have been maximum if the minimum sum elements sum were not present so we should exclude it."what exactly is meant by this?
@Subham2107
There are two possibilties in this question. One is that the subarray is present simply and there is no point in taking it as circular , that is , the maximum sum subarray does not need to include the roundabout provided by the array being circular.
In such a case , a simply Kadane’s Algo works.
The other possiblity is that the max subarray sum requires the roundabout provided by the circular array. In such a case , we implement the Algo as you have. Take the inverse of terms and then apply the Kadane’s Algo. The maximum sum thus obtained from the inverse array is actually the minimum subarray sum of the original array.
Subtracting this minimum subarray sum from the total sum would give us the max circular sum. Now read the statement.
Here we can conclude that this algorithm works because it explains the fact the array’s sum could have been maximum if the minimum sum elements sum were not present so we should exclude it.
The statement only talks about the thing I explained above about the minimum sum. If we exclude the minimum sum obtained through applying Kadane on inverse array , we get the maximum circular sum . That is all it says.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.