def getMoneySpent(keyboards, drives, b):
buy = -1
for k in keyboards:
if k < b:
for d in drives:
if k + d <= b:
buy = max(buy, k + d)
return buy
'# 코딩 문제 관련 > 파이썬' 카테고리의 다른 글
[HackerRank-python] Forming a Magic Square (0) | 2022.07.10 |
---|---|
[HackerRank-python] Cats and a Mouse (0) | 2022.07.10 |
[HackerRank-python] Counting Valleys (0) | 2022.07.10 |
[HackerRank-python] Drawing Book (0) | 2022.07.07 |
[HackerRank-Python] Sales by Match (0) | 2022.07.07 |