Probability That the Last Kept Ball Is Blue
You are given a bag that initially contains 2 red balls and 2 blue balls. You will repeatedly draw one ball from the bag at random until all balls have been kept (i.e., permanently removed from the bag). The rules for keeping or returning a ball are as follows: If you draw a red ball, you keep it and remove it from the bag. If you draw a blue ball: If it is not the second blue ball in a row, you put it back into the bag. If it is the second blue ball in a row, you keep it and remove it from the bag. Note: The “second blue in a row” means you drew a blue ball immediately after having drawn a blue ball in the previous turn. This process continues until all balls have been kept. Write a function to compute the probability that the last ball you keep is a blue ball, following the rules above.
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late June, 2025
Junior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.