1396. Design Underground System
Medium
<ul> <li>A customer with a card ID equal to <code>id</code>, checks in at the station <code>stationName</code> at time <code>t</code>.</li> <li>A customer can only be checked into one place at a time.</li> </ul> </li> <li><code>void checkOut(int id, string stationName, int t)</code> <ul> <li>A customer with a card ID equal to <code>id</code>, checks out from the station <code>stationName</code> at time <code>t</code>.</li> </ul> </li> <li><code>double getAverageTime(string startStation, string endStation)</code> <ul> <li>Returns the average time it takes to travel from <code>startStation</code> to <code>endStation</code>.</li> <li>The average time is computed from all the previous traveling times from <code>startStation</code> to <code>endStation</code> that happened <strong>directly</strong>, meaning a check in at <code>startStation</code> followed by a check out from <code>endStation</code>.</li> <li>The time it takes to travel from <code>startStation</code> to <code>endStation</code> <strong>may be different</strong> from the time it takes to travel from <code>endStation</code> to <code>startStation</code>.</li> <li>There will be at least one customer that has traveled from <code>startStation</code> to <code>endStation</code> before <code>getAverageTime</code> is called.</li> </ul> </li>
Last updated