I was doing this problem on codechef
my solution is absolutely correct still it’s not getting accepted can your please check and help me
my solution
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int t = sc.nextInt();
while(t-- > 0) {
int noOfPeople = sc.nextInt();
int[] points = new int[noOfPeople];
for(int i=0; i<noOfPeople; i++) {
points[i] = sc.nextInt();
}
int count=0;
int min = 1;
int max = 1;
boolean result =true;
for(int i =0; i<=points.length-2;i++) {
if(Math.abs(points[i]-points[i+1]) >2) {
count=0;
result = false;
}
else {
count++;
if(result)
min++;
}
}
System.out.println();
if(count ==0)
max = min;
else
max = max + count;
System.out.println(min+" "+max);
}
}