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
      40 of 130

      How many tables stay empty?

      Customers come into a café one by one, and each picks a table on their own: table i with chance popularity[i] (the window tables are favourites). Several can pick the same table. Write expected_empty(customers, popularity): how many tables nobody picks, on average over many nights. The puzzle’s nights go up to 40 customers at 12 tables.

      A 12-table bistro on a 40-customer night: each customer picks a table, popular ones more often, and the empty ones get a ring. Subtracting customers from tables goes negative, and listing every seating means 12^40 of them. Over 100 nights the empty tables wobble round an average: the goal is that average, from popularity alone.

      A café with 12 tables. By the window they’re popular, by the kitchen not.windowdoorkitchen side16%14%12%10%8%8%7%7%5%5%4%4%0 of 40 customers seated100 nights: empty tables in each
      Your functionexpected_empty(customers, popularity)
      customershow many customers come in tonighte.g. 1
      popularitypopularity[i] is the chance a customer picks table i (they add up to 1)e.g. [0.5, 0.5]
      returnshow many tables nobody picks, on average
      solution.pyLoading Python
      Sign in for an AI hint
      ← Both lights greenCollect them all →