My issue
what is wrong with this approach
My code
import java.util.*;
class Codechef
{
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);
int t = read.nextInt();
int ele;
int teamA=0;
int teamB=0;
for(int i=0; i<t; i++)
{
int n = 10;
ArrayList<Integer> a = new ArrayList<Integer>();
for(int j=0; j<n; j++){
ele = read.nextInt();
a.add(ele);
}
// Update your code below this line to solve the problem
for( int k=0; k<10; k++){
if(k%2==0){ //teamA count
if(a.get(k)==1){
teamA= teamA+1;
}
}
else{
if(a.get(k)==1){
teamB= teamB+1;
}
}
}
if(teamA>teamB)
System.out.println("1");
else if (teamB>teamA)
System.out.println("2");
else if (teamA==teamB)
System.out.println("0");
}
}
}
Learning course: Beginner DSA in Java
Problem Link: CodeChef: Practical coding for everyone