My issue
i did not reach to the solutions please help
My code
import java.util.*;
class Codechef
{
public static void main (String[] args)
{
Scanner read = new Scanner(System.in);
int t = read.nextInt();
for(int i=0; i<t; i++)
{
ArrayList<Integer> face = new ArrayList<Integer>();
int n = read.nextInt();
int a = read.nextInt();
int b = read.nextInt();
// Update the code below to solve this problem
// ArrayList<Integer> a=new ArrayList<Integer>();
for(int j=0;j<n;j++)
face.add(read.nextInt());
int c1=2;
int c2=0;
for(int j=0 , k=n-1; j<=n-1 && k>=1 ;j++,k--)
if((face.get(j)==a && face.get(j+1)==b) && (face.get(k-1)==a && face.get(k)==b))
c1+=2;
else
c2+=2;
for(int j=0 , k=n-1; j<=n-1 && k>=1 ;j++,k--)
System.out.println(j+" "+k);
System.out.println((double)(Math.abs(c1-c2))/(2*n));
}
}
}
Learning course: Solve Programming problems using Java
Problem Link: CodeChef: Practical coding for everyone