Sir please help

sir my code is not passing all the testcases

Hey, u are not handling the case of negative numbers since u initialised sum variable with 0. So initialise sum with minus infinity…
U can write as
int sum = INT_MIN;
and include this header file -

#include<climits>

hey,
consider the input --> -5 -2 -3 -9 -1
expected o/p --> -1
ur o/p --> 0

corrected code -->


It will pass all test cases now…

@puneetgupta154_71b515b6c374367b
Is there anything else?