using namespace std;
int main()
{
int n,k,t;
cin>>t;
for(k=0;k<t;k++)
{
cin>>n;
int a[100000];
for(int i=0; i<n; i++)
{
cin>>a[i];
}
int cs=0,ms=0;
for(int i=0;i<n;i++)
{
cs=cs+a[i];
if(cs<0)
{
cs=0;
}
ms=max(ms,cs);
}
cout<<ms<<endl;
}
return 0;
}
What is wrong in this code max subarray sum challenge
hey, that might sound weird but i am not able to find how to copy the link out there could u please check it in this way only if possible
exactly thats my point i have checked it every way!!!
ok lemme try once again…if that doesnt work i will send the ss
hey it worked out
i dont know why did that happened sorry for troubling…thanx:)
1 Like
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.

