The code block showing TLE ? what is the problem in the code

import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int nArray = scn.nextInt();
for (int c = 1; c <= nArray; c++) {
int n = scn.nextInt();
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i] = scn.nextInt();
}

		int sum = 0;
		int max = Integer.MIN_VALUE;
		int min = 0;
		int rem = 0;
		for (int count = 0; count < arr.length; count++) {
			max = arr[count];
			for (int i = count; i < arr.length; i++) {
				rem = sum + arr[i];
				if (rem > max)
					max = rem;
				sum = rem;
			}
			sum = 0;
			if (max > min)
				min = max;
		}
		System.out.println(min);

	}

}

}

hey @Harsh_Sonwani
Constraints

1 <= N <= 100000

1 <= t <= 20

-100000000 <= A[i] <= 100000000
Constraints is too big.

An efficient way is to use Kadane’s Algorithm . Use Kadane’s algorithm to find the largest sum of contiguous subarray with runtime of O(n).Simple idea of the Kadane’s algorithm is to look for all positive contiguous segments of the array . And keep track of maximum sum contiguous segment among all positive segments .
long kadens(int arr[]) {
Long max = Long.MIN_VALUE;
long sum = 0;
for (int i = 0; i < arr.length; i++) {
sum += arr[i];
if (sum > max) {
max = sum;
}
if (sum < 0) {
sum = 0;
}
}
return max;
}

first of all tell me what is this kandane algorithmk no one has taught me & what is problem in my code

what is problem in my code
answer : code is fine but Time Complexity is O(N^2). So you are getting TLE
try to Solve in One loop.
you have only one option to apply Kadane’s Algorithm . Time complexity is O(N)
We will proceed in a linear fashion maintaining overall_max and current_max variables. If adding the current element to current_max results in overall maximum value, we will replace the value of overall_max variable. Otherwise, we will proceed furthere.
algo
Initialize:
max_so_far = 0
max_ending_here = 0

Loop for each element of the array
(a) max_ending_here = max_ending_here + a[i]
(b) if(max_ending_here < 0)
max_ending_here = 0
(c ) if(max_so_far < max_ending_here)
max_so_far = max_ending_here
return max_so_far

true be honest mujhe kandane algorithm nhi aya smjh mai
& next question is Mazimum Circular sum vo bhi nhi bnra & time complexity nhi btaya gya hai

chill bro. Time complexity will be discussed after Recursion. you can call me
i will explain Kadanes algo

may i call u now ?
sir?

@Harsh_Sonwani
yes sure