armaghanwa
BAN USER""
THIS IMPLEMENTATION IS JUST A PYTHON VERSION OF AN OLDER POST WITH SOME EXPLANATION
Input: Two arrays. One for interval and other for the price of each interval.
Compute: We need to find the best value for the time duration we rent out the car, such that
there is no intersection between the time intervals. For simplicity I have just use discrete time interval with no overlap.
""
def bestDeal():
## [s,e]
interval = ((1,2),(2,4),(4,10))
price_interval = (30,20,100)
max_price = 0
best_interval = 0
for i in range(0,len(interval)):
price_comp = price_interval[i]/(interval[i][-1] - interval[i][0])
if max_price < price_comp:
max_price = price_comp
best_interval = i
print('Best Interval',interval[i],'at $',price_interval[i])
Replillyalaird, Associate at Achieve Internet
I am Lilly from Eau Claire USA, I am working as a manager in a Best products company. My interest ...
Repstacyrdavid, Associate at Abs india pvt. ltd.
Hi, I am Stacy working as a Cashier in Dollar store the US. I work for Us government to Collect ...
RepPriscillaRYoung, Aghori Mahakal Tantrik at Absolute Softech Ltd
Hi, I am Priscilla from California. I am working as a Business management consultant in Quality Merchant Services company. I ...
RepGrimesOtto, Java Developer at Coupondesh
I am Grimes Agriculture inspector. I examine agriculture commodities and related operations . I like listening to music, painting, and reading ...
RepRhondaLillie, Android test engineer at AppNexus
I work as an General and operations manager at the Official All Star Café. presenting love stories, ghost stories. Currently ...
- armaghanwa April 01, 2019