You are viewing a single comment's thread. Return to all comments →
Two-pointer solution:
keyboards.sort() drives.sort(reverse=True) best = -1 i = j = 0 while i < len(keyboards) and j < len(drives): total = keyboards[i] + drives[j] if total > b: j += 1 else: if total > best: best = total i += 1 return best
Seems like cookies are disabled on this browser, please enable them to open this website
Electronics Shop
You are viewing a single comment's thread. Return to all comments →
Two-pointer solution: