My issue
help me in code
My code
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef {
public static void main(String[] args) throws java.lang.Exception {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int len = sc.nextInt();
int[] arr = new int[len];
int d = 0;
for (int i = 0; i<len; i++) {
arr[i] = sc.nextInt();
}
for (int j = 0; j<len; j++) {
for (int k = j+1; k<len; k++) {
d = Math.max(d, Math.min(Math.abs(j-k), Math.abs(arr[j] - arr[k])));
}
}
System.out.println(d);
}
}
}
Problem Link: Find Diameter Practice Coding Problem - CodeChef