What is the prob. with this program

mport java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int m = scn.nextInt();
for (int z = 0; z < m; z++) {
int n = scn.nextInt();
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i] = scn.nextInt();
}
int max = Integer.MIN_VALUE;
for (int a = 0; a < arr.length; a++) {
int x = arr[a];
if (x > max)
max = x;
int s = 0;
for (int b = a + 1; b < arr.length; b++) {
s = x + arr[b];
if (s > max) {
max = s;
}
x = s;
}

	}
	System.out.println(max);
}

}
}

Hey @himanshusingh2389_63aac7fac0c69386 You are getting TLE bcoz your code is running in O(n^2).Do this question by kadanes algorithm.

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.