Solutions for Team selection

    • @Geraldpof
    • @Charles, submitted in Python 2, achived 100% score
    def solve(a, b, c):
        a = list(sorted(set(a)))
        b = list(sorted(set(b)))
        c = list(sorted(set(c)))
    
        ai = 0
        bi = 0
        ci = 0
    
        ans = 0
    
        while bi < len(b):
            while ai < len(a) and a[ai] <= b[bi]:
                ai += 1
    
            while ci < len(c) and c[ci] <= b[bi]:
                ci += 1
    
            ans += ai * ci
            bi += 1
    
        return ans
    • @DarrenNop
    • @william, submitted in Python 3, achived 100% score
    def solve(a, b, c):
        a = list(sorted(set(a)))
        b = list(sorted(set(b)))
        c = list(sorted(set(c)))
    
        ai = 0
        bi = 0
        ci = 0
    
        ans = 0
    
        while bi < len(b):
            while ai < len(a) and a[ai] <= b[bi]:
                ai += 1
    
            while ci < len(c) and c[ci] <= b[bi]:
                ci += 1
    
            ans += ai * ci
            bi += 1
    
        return ans