one test case did not pass
One test case failed
#include ??
#include ?
pls explain the case of all numbers negative (nonwrapsum)
@akshitabansal321 try
-1 -2 -3 ans will be -1 but it will give 0 as totalsum is -6 and reverse sign sum is 6
when u do totalsum - -(reverse sum) it will be 0
nonwrapsum = kadane(a,n);
// if all nos are negative
if(nonwrapsum < 0){
cout<<nonwrapsum<<endl;
continue;
}
in case of all negative numbers nonwrapsum=0(kadane will return 0) β¦this if statement will never get executed