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

      Same birthday in the room

      Everyone in a room has a birthday on one of days equally likely days: 365 on Earth, and the puzzle also visits a planet with a 30-day year and one with a 10-day year. Write chance_shared(people, days): the chance, from 0 to 1, that at least two of the people in the room share a birthday.

      A room of 23 people on Earth, each birthday dropping onto its day. The obvious guess, 23 out of 365, says 6%; 100 rooms like it say otherwise, and adding up a chance per pair runs past 100%. The goal is the exact chance those rooms point to. Your chance_shared() works it out for any room and any calendar.

      23 people walk into a room on Earth, one by one. Each birthday lands on its day.Earth’s calendar: 365 days23 people to come in100 rooms of 23, amber: two share51 of 100 rooms share a birthday
      Your functionchance_shared(people, days)
      peoplehow many people are in the roome.g. 1
      dayshow many equally likely birthdays there are (365 on Earth)e.g. 365
      returnsthe chance, from 0 to 1, that at least two of them share a birthday
      solution.pyLoading Python
      Sign in for an AI hint
      ← Which sum comes up most?Both lights green →