One test case failed

one test case did not pass

hi @akshitabansal321,
updated https://ide.codingblocks.com/s/669137

#include ??

@akshitabansal321 no need u can remove

#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

it will be negative do a dry run @akshitabansal321

1 Like