My issue
how can this 1 1 2 0 0 has 6 pairs when replaced 0’s with 1’s.
eg: 1 1 2 1 1 has equal pairs with indices (0,1), (0,3), (0,4), (1,3), (1,4) that equals to 5. plz explain
My code
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scan = new Scanner(System.in);
int T = scan.nextInt();
while(T-- >0){
int N = scan.nextInt();
ArrayList<Integer> arr = new ArrayList<>();
for(int i=0; i<N; i++){
int eachNum = scan.nextInt();
}
}
}
}
Problem Link: Equal Pairs (Easy) Practice Coding Problem