My issue
My code
import java.util.*;
class Codechef {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
int[] b = new int[n];
for (int i = 0; i < n; i++) {
b[i] = in.nextInt();
}
boolean possible = true;
for (int i = 0; i < n; i++) {
int a1 = b[i];
int a2 = b[(i + 1) % n];
int expectedSum = (a1 + a2) % 2;
if (expectedSum != b[i]) {
possible = false;
break;
}
}
if (possible) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
}
Problem Link: ADJSUMPAR Problem - CodeChef