Compare the Triplets

  • + 10 comments

    Python3 one-liner:

    def solve(a, b):
        return map(
            lambda t: sum([x > y for x, y in zip(*t)]), 
            ((a, b), (b, a))
            )
    

    Equivalent to:

    def solve(a, b):
    
        def compare_sum(tuple_):
            return sum([x > y for x, y in zip(*tuple_)])
    
        return map( compare_sum, ((a, b), (b, a)) )