• + 10 comments

    Well, did it the pythonic 1 line way

    def getMoneySpent(keyboards, drives, s):
            return max([sum([x,y]) for x in keyboards for y in drives if sum([x,y]) <= s]+[-1])