Compare the Triplets

Sort by

recency

|

4268 Discussions

|

  • + 0 comments

    Python 3 solution:

        scores = [0, 0]
        for count, triplet in enumerate(a):
            scores[0] += a[count] > b[count]
            scores[1] += b[count] > a[count]
        return scores
    
  • + 0 comments

    IN C++;

    vector compareTriplets(vector a, vector b) { int alice=0; int bob=0;

    for(int i=0;i<3;i++)    
    {
        if(a[i]>b[i])
        {
            ++alice;
        }
        else if(a[i]<b[i]){
            ++bob;
        }
    }
    return {alice,bob};
    

    }

  • + 1 comment

    c# int aliceScore = 0; int bobScore = 0; for(int i =0;i<3;i++){ if(a[i] > b[i]){ aliceScore++; } else if(a[i] {aliceScore,bobScore};

  • + 0 comments

    teamA = 0 teamB = 0

    for i in range(len(a)):
        if a[i] > b[i]:
            teamA +=1
        elif a[i]<b[i]:
            teamB +=1
    return list([teamA,teamB])  
    
  • + 0 comments
    public static List<Integer> compareTriplets(List<Integer> a, List<Integer> b) {
            var alices = 0;
            var bobs = 0;
            for (int i = 0; i < 3; i++) {
                if(a.get(i) > b.get(i))
                    alices++;
                else if(a.get(i) < b.get(i))
                    bobs++;
            }
            return List.of(alices, bobs);
        }