Not passing a test case...?

Why my code is not passing test cases…?
What is that boundary condition where code is falling?

@dheerajk_7 share your code here with coding blocks ide

#include<iostream>

using namespace std;
int main() {
int n;
int no;
cin>>n;
for (int i=0;i<n;i++)
{
cin>>no;
int a[no];
for(int j=0;j<no;j++)
{
cin>>a[j];
}
int result=0;
for (int k=0;k<no;k++)
{
if(result<0)
{
result=0;
}
else{
result+=a[k];
}
}
if(result==0)
{
result=-32766;
for(int l=0;l<no;l++)
{
if(a[l]>result)
{
result=a[l]
}
}
}
cout<<result;
}
return 0;
}

@dheerajk_7 hey Dhiraj you writing so complex you have to write a simple code using kadane algorithm I know you have used it but you can use the inbuilt max function for calculating the max value

can u plz share a test case with me so that i came to know where i’m wrong

@dheerajk_7 first save your code and then share through coding blocks ide

How to share it with you? I have tried share option but it is not showing any link to share with you.

@dheerajk_7 dheeraj visit cb.lk/ide and copy your code their and tap save button it will generate a link that link you have to share

it is not showing any link there just appearing as a blank

could you plz share a sample code in which u have used max function to calculate max of an array?

@dheerajk_7 hey dheeraj khuswah please share your code through ide.codingblocks.com

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.