For the best experience, increase the window size or view on a laptop or desktop device
Last updated: Pending
Title | ||
|---|---|---|
Loading... | ||
1/1
No questions are available yet
For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
Given shoppers picking up orders from one location and delivering to another location, calculate the average travel time between locations.
public void pickup(int timestamp, String pickUpLocation, int shopperId)
public void deliver(int timestamp, String, DeliverLocation, int shopperId)
public double calculateAverage(String locationB, String locationB)
Example:
Test case:
pickup(0, "A", 1); // shopper1 picks up at location A at time 0
deliver(5, "B", 1); // shopper1 delivers at location B at time 5
pickup(0, "A", 2); // shopper2 picks up at location A at time 0
deliver(6, "B", 2); // shopper2 delivers at location B at time 6
calculateAverage("A", "B") -> 5.5
Given shoppers picking up orders from one location and delivering to another location, calculate the average travel time between locations.
public void pickup(int timestamp, String pickUpLocation, int shopperId)
public void deliver(int timestamp, String, DeliverLocation, int shopperId)
public double calculateAverage(String locationB, String locationB)
Example:
Test case:
pickup(0, "A", 1); // shopper1 picks up at location A at time 0
deliver(5, "B", 1); // shopper1 delivers at location B at time 5
pickup(0, "A", 2); // shopper2 picks up at location A at time 0
deliver(6, "B", 2); // shopper2 delivers at location B at time 6
calculateAverage("A", "B") -> 5.5
Output