Triple sum

  • + 0 comments

    def triplets(a, b, c): a.sort() c.sort() count = 0 for b_val in b: count_a = sum(1 for x in a if x <= b_val) count_c = sum(1 for y in c if b_val>=y) count += count_a * count_c return count

    Why is this partially correct?