Electronics Shop

Photo by Domenico Loia on Unsplash
def getMoneySpent(keyboards, drives, b):
cart=[]
for keyboard in keyboards:
for drive in drives:
price=keyboard+drive
if price<=b:
cart.append(price)

if min(keyboards)+min(drives)>b:
return -1
else:
return max(cart)

--

--

--

Work in progress

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Fix It Once

Design your code for readability vs. writability.

CS 373 Spring 2022: Bruce Nguyen

Original Scratch Game: Jordan Reiser

Insider’s guide to System Design Interviews

What Software Testers Need to Know About Browser Differences

Puzzle #2: how many triangles can you see?

Technical Development of GUHADA!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Parag Naik

Parag Naik

Work in progress

More from Medium

Scholar @ SAP Labs interview experience

Winning DevRel Interviews

People shaking hands on accepting a job offer.

Wipro Interview Experience | Elite NTH Hiring — On Campus (Easy)

Append nums to itself to get rid of circular effect.