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

      How many heads?

      Flip a coin flips times; each flip lands heads with chance p, whatever the other flips did. Write chance_of_heads(flips, heads, p): the chance of getting exactly heads heads. Some of the coins are fair, and some are bent.

      All 16 orders 4 flips can land in (● heads, ○ tails), grouped by how many heads each has. The obvious chance of 2 heads counts one order and misses the other five. Then a bent coin that lands heads 80% of the time makes each order’s block as tall as its chance. The goal is the columns it ends on. Once it has played, click a column.

      Flip a fair coin 4 times: it can land in 16 orders, all equally likely.4 flips of a fair coinheadstailsorders14641heads01234
      Your functionchance_of_heads(flips, heads, p)
      flipshow many times the coin is flippede.g. 3
      headshow many heads you want, exactlye.g. 0
      pthe chance that one flip lands heads, e.g. 0.5 for a fair coine.g. 0.5
      returnsthe chance of exactly that many heads
      solution.pyLoading Python
      Sign in for an AI hint
      ← Switch or stay?Calls per minute →