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

      Both lights green

      Two traffic lights stand on your way to work, and you logged them for some days: each day is a pair [first_green, second_green], 1 if that light was green when you got there and 0 if not. Write chance_both(log): the chance that both lights are green on a day, judging by the log.

      Two traffic lights logged for 20 days: light 1 on top, light 2 below, green when it was green. Each is green half the time, so multiplying says both are green a quarter of the days, but these two share a timer. Rewired to the opposite, multiplying still says a quarter. The goal is the chance both are green, read from the log.

      Two traffic lights on your way to work, logged for 20 days.light 1light 21234567891011121314151617181920light 1 green on 10 of 20 days · light 2 on 10 of 20both green: 0 of 20
      Your functionchance_both(log)
      loga list of days, each [first_green, second_green]: 1 if that light was green that day, 0 if note.g. [[1, 1], [0, 0], [1, 1], [1, 0], [0, 1], […
      returnsthe chance that both lights are green on a day
      solution.pyLoading Python
      Sign in for an AI hint
      ← Same birthday in the roomHow many tables stay empty? →