HI! this is my code and I know that it has something to do with variable t i.e. test case. Following is my code.
#include
using namespace std;
int main()
{
int t;
cin>>t;
int a=1;
while(a<=t)
{
int n;
int max = 0;
cin>>n;
int arr[100000];
for (int i=0;i<n;i++)
{
cin>>arr[i];
}
int curr[100000];
curr[0] = arr[0];
int sum;
for (int i=1;i<n;i++)
{
curr[i] = curr[i-1] + arr[i];
}
for (int i=0;i<n;i++)
{
for (int j=i;j<n;j++)
{
sum = curr[j] - curr[i-1];
if (sum>max)
{
max = sum;
}
}
}
cout<<max<<endl;
}
return 0;
}