TLE WHILE SUBMITTING
Constraints
1 <= N <= 100000
1 <= t <= 20
-100000000 <= A[i] <= 100000000
look at constraints n is of the order 10^5
and your code time complexity is O(n^3) which will definitely give tle
you can solve this question using kadane’s algorithm
for kadanes algorithm see this
i have explained this
if you want to ask something about this feel free to ask here
i hope this helps
if yes show your response with
and don’t forgot to mark doubt as resolved
initially you have to set ms as int_min and cs to 0
int T,N,ms=INT_MIN,cs=0;
after that it will give correct outpout