We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
From the Problem explanation for Sample 0: "With probability 0.25 there will be three dances (the course will end in one day or two days but we don't care about it)."
This is false. There is no way that exactly three dances can occur with the class ending on the second day. To see this, notice that no day can finish with fewer than two dances, so all three would have to occur on the same day. Therefore, the probability of exactly three dances is (1/2)(1-r)(1/2)=(1-r)/4 (i.e. 1/2 for second matching the first, 1-r for not quitting, and 1/2 for the third not matching the first two).
This sort of subtlety will only increase with the the total number of dances, so I am suspicious that any particularly nice closed form solution is possible without some pretty serious combinatorial reasoning.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Bear and Dancing
You are viewing a single comment's thread. Return to all comments →
From the Problem explanation for Sample 0: "With probability 0.25 there will be three dances (the course will end in one day or two days but we don't care about it)."
This is false. There is no way that exactly three dances can occur with the class ending on the second day. To see this, notice that no day can finish with fewer than two dances, so all three would have to occur on the same day. Therefore, the probability of exactly three dances is (1/2)(1-r)(1/2)=(1-r)/4 (i.e. 1/2 for second matching the first, 1-r for not quitting, and 1/2 for the third not matching the first two).
This sort of subtlety will only increase with the the total number of dances, so I am suspicious that any particularly nice closed form solution is possible without some pretty serious combinatorial reasoning.