 All Problems
Design Underground System
medium
design
hash table
string
amazon
google

An underground railway system tracks customer travel times between stations.

Implement the UndergroundSystem class:

  • void checkIn(int id, String stationName, int t)
  • void checkOut(int id, String stationName, int t)
  • double getAverageTime(String startStation, String endStation) — returns the average time for the route.

Example:

checkIn(45,"Leyton",3), checkOut(45,"Waterloo",15), getAverageTime("Leyton","Waterloo")→12.0
Run to check your code against the sample cases, or submit to run every case