Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      46 of 130

      The bus you wait for

      A bus stop’s timetable is a list of gaps: the minutes between one bus and the next. Write average_wait(gaps): how long a passenger who turns up at a random moment waits for the next bus, on average. Nobody checks the timetable; they just turn up.

      One hour at a bus stop: a bus every 10 minutes on average, but not evenly. Passengers turn up at random moments; each stick is how long one of them waits for the next bus. The obvious guess, half of 10, comes out too low. The goal is the line it ends on, the average of all the sticks. Once it has played, click a gap.

      One bus stop, one hour: 7 buses, 10 minutes apart on average.the opening’s hour: buses 10 minutes apart on average416 min218 min10 min10 mingapswait
      Your functionaverage_wait(gaps)
      gapsthe minutes between one bus and the next, through the day, e.g. [5, 15] (a numpy array)e.g. [10, 10, 10, 10, 10, 10]
      returnshow long a passenger who turns up at a random moment waits for the next bus, on average, in minutes
      solution.pyLoading Python
      Sign in for an AI hint
      ← Until the first sixWhy sums look like bells →