• + 0 comments
    from itertools import product
    def get_money_spent(keyboards, drives, b):
        possible_sums = [ x + y for x,y in list(product(keyboards, drives)) if x + y <= b ]
        return max(possible_sums) if len(possible_sums) > 0 else -1