Compare the Triplets

  • + 0 comments

    java

     public static List<Integer> compareTriplets(List<Integer> a, List<Integer> b) {
            ArrayList<Integer> ans = new ArrayList<>();
            int aCount=0;
            int bCount=0;
            
            for(int i=0;i<3;i++){
                if(a.get(i)>b.get(i)){
                    aCount++;
                }
                else if(a.get(i)<b.get(i)){
                    bCount++;
                }
                else{
                    continue;
                }
            }
            ans.add(aCount);
            ans.add(bCount);
            
            return ans;
    
        }
    
    }