Compare the Triplets

  • + 0 comments

    Solution in Java - feel free to review my code -

    int[] tripletsResult = new int[2];

        for (int i = 0; i < a.size(); i++) {
            if (a.get(i) > b.get(i)) {
                tripletsResult[0] = tripletsResult[0] + 1;
            } else if (b.get(i) > a.get(i)) {
                tripletsResult[1] = tripletsResult[1] + 1;
            }
        }
    
                List<Integer> tripletsResult1 = new ArrayList<>(List.of(tripletsResult[0], tripletsResult[1]));
    
                return tripletsResult1;
    
        List<Integer> tripletsResult1 = new ArrayList<>(List.of(tripletsResult[0], tripletsResult[1]));
    
        return tripletsResult1;