#include
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
int n,s=0,e=0;
int arr[100001];
cin>>n;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
s=arr[0];
e=arr[0];
for(int i=0;i<n;i++)
{
e=e+arr[i];
if(e<0)
{
e=0;
}
if(s<e)
{
s=e;
}
}
cout<<e<<endl;
}
return 0;
}
Even aftr correcting the again it is showing the error
it showing wrong answer
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.