Facing problem while submitting my code
ide is not giving any judgement
this is my code -
#include<bits/stdc++.h>
using namespace std;
int maxSubArraySum(int a[],int n){
int cs = 0;
int ms = 0;
for(int i=0;i<n;i++){
cs+=a[i];
if(cs<0){
cs = 0;
}
ms = max(cs,ms);
}
return ms;
}
int main() {
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
cout<<maxSubArraySum(a,n)<<endl;
}
return 0;
}