Compare the Triplets

  • + 5 comments

    We can just use a single for loop and maintain two counters for points. something like this in Python2:

    def compareTriplets(a, b):
        alice_points = 0
        bob_points = 0
        for i in range(3):
            if a[i] > b[i]:
                alice_points +=1
            elif a[i] < b[i]:
                bob_points += 1
        return [alice_points, bob_points]