We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Electronics Shop
Electronics Shop
+ 0 comments Python
def sum_cartez(p): return p[0] + p[1] def getMoneySpent(keyboards, drives, b): sorted_pairs = sorted(product(keyboards, drives), key=sum_cartez, reverse=True) for el in sorted_pairs: total_cost = sum_cartez(el) if total_cost <= b: return sum_cartez(el) return -1
+ 0 comments python 3 one-liner
def getMoneySpent(keyboards, drives, b): return(max([x+y if x+y<=b else -1 for x in keyboards for y in drives]))
+ 0 comments def getMoneySpent(keyboards, drives, b): lst = [-1] for i in keyboards: for j in drives: if (i + j) <= b: lst.append(i+j) return max(lst)
+ 0 comments now they think i am a spammer
+ 0 comments The computer thinks i am a bot for some reason
Load more conversations
Sort 2181 Discussions, By:
Please Login in order to post a comment