Round1: DSA
Food delivery companies employ tens of thousands of delivery drivers who each submit hundreds of deliveries per week.
Delivery details are automatically sent to the system immediately after the delivery.
Delivery drivers have different hourly payment rates, depending on their performance.
Drivers can take on, and be paid for, multiple deliveries simultaneously.
If a driver is paid 15.00 for that delivery.
We are building a dashboard to show a single number - the total cost of all deliveries - on screens in the accounting department offices.
At first, we want the following functions:
addDriver(driverId [integer], usdHourlyRate [float])
recordDelivery(driverId [integer], startTime, endTime)
getTotalCost()
All inputs will be valid.
Share any decisions or assumptions you make.
If you do anything differently in this interview than you would in production, share that.
Before coding, let's discuss how you will store the time data and why.
We want to see good OOP practices.
You may look up syntax using a search engine.
Q2
The analytics team uses the live dashboard reporting function you built to see how much money is owed in total to all drivers.
Add the following functions:
payUpTo (payTime)
getTotalCostUnpaid()