I failed to solve them, but still record here where I got stuck

B. Crossing the road

I am not familar with techinques of modifying exisiting graph algorithms. Too little experience with it. That is why I was not sure what node in the graph should represent

C. Collecting cards

geometric distribution: number Y = X - 1 failure before the first success. Each failure is independent and has a failure rate p

coupon collector problem (CCP)

hyper geometric distribution:k success in n draws, without replacement from a finite populate of size N that contains exactly K success, i.e., N, K are upper bounds for n, k, respectively

Sharing the insight with CCP:

P(m, n) = after we have n different cards, what is the probability that we can get m new cards from the next package (in CCP m = 1)?

since now we have a handle at the state of having n cards, we will ask the expectation with n in it, i.e.

Ex(n) = # of expected packs to buy to collect n cards

and we can define Ex(n+ m) based on Ex(n) and P(m,n)

One problem I ran into is how to calculate P(m,n) with high enough precision. Turns out I should calculate binomial coefficient in a recursive way