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

      Ask 25 bad judges

      The problem. A bakery logged its queue 100 times, on different days. A judge guesses the queue at any time of day by copying the nearest logged visit. That makes it jumpy: one day 5 people happened to queue at 10:18, where 2 is usual, so the judge says 5 for 10:18. Averaging many judges should cancel odd days like that, but 25 judges who learned from the same 100 visits make 25 identical guesses, and their average is just as jumpy.Your job. Choose which visits each judge learns from. rows_for(judge, n_rows) returns a list of row numbers from 0 to 99 (one row is one logged visit, and a row may appear more than once).What the puzzle does with your list:1. It calls rows_for(j, 100) for each judge j = 0 … 24.2. Judge j learns only from the visits you listed for it: at any time of day it says the queue at the nearest of them.3. The crowd’s guess at each time is the average of the 25 judges’ guesses.4. It scores the crowd: how many people it is off from the usual queue, averaged over the day. You win when the crowd is off by less than one judge who saw all 100 visits (1.257 people).

      The bakery’s 100 logged visits (dots) and its usual queue (dashed). One judge copies the nearest visit, so its line jumps with every odd day. 25 judges who all saw every visit draw that same line, so their average is no better. The goal is the calm line it ends on. Your rows_for() decides which visits each judge sees.

      A bakery logged its queue 100 times, on different days: one dot per visit.people queueing05108:0010:0012:0014:0016:0018:00who saw which visitjudges 0–24 ↓ · visits 0–99 →
      Your functionrows_for(judge, n_rows)
      judgewhich judge this is, 0 to 24e.g. 0
      n_rowshow many visits the bakery logged (rows 0 to n_rows - 1)e.g. 100
      returnsthe row numbers this judge learns from, as a list (a row may appear more than once)
      solution.pyLoading Python
      Sign in for an AI hint
      ← Everyone is far awayFix the last one’s mistakes →