https://ide.codingblocks.com/s/126111…Link to the code is given when i am submitting the code it is showing no output and i have tried running the code it is showing the output on ide. kindly tell the mistake and rectify it
No output shown while submitting code
@Madhavendra-Gupta-2240591552663161 See properly the constraints:
Constraints
1 <= N <= 100000
1 <= t <= 20
-100000000 <= A[i] <= 100000000
You are restricting the array size to 1000. So increase that to 100000 and check
i tried …u tell me how to put constraints condition in our code… this was my doubt as well.
make changes in the code and send the link please
@Madhavendra-Gupta-2240591552663161
#include < iostream >
using namespace std;
int main(){
int t;
cin>>t;
while(t- -){
int ms=INT_MIN;
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int cs=0;
for(int i=0;i<n;i++){
cs+=arr[i];
if(cs<0){
cs=0;
}
ms=max(cs,ms);
}
cout<<ms<<endl;
}
}