Kadane Algorithm Problem

#include
using namespace std;

int main() {

int t;

while(t>=0)
{
    int n;
    cin>>n;
    
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    
    int cs=0,ms=0;
    
    for(int i=0;i<n;i++)
    {
        cs+=arr[i];
        
        if(cs<0)
        {
            cs=0;
        }
        
        ms=max(cs,ms);
        
    }
    
    cout<<ms<<endl;
    
      t--;
}

Not correct please help

Hey @arsh_goyal
You forgot to take T as input. Also try to change int to long long.

If your doubt is resolved please mark it as closed.

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.