Project Euler #84: Monopoly odds

  • + 0 comments

    Successively approximation is superb for this problem. I got this idea from thinking about Newton Raphson and chemical equilibrium. Start with an initial arbitrary (in my case, all 0.025) list of probabilities (probability of the player standing on this corresponding square at the end of the last round).

    Use another list to accumulate the probabilities of the player ending up standing in each square which are generated in this round, by iterating each of the squares. Divide them by a common divisor to make sure their sum is . After certain approximating iterations we would end up with a fairly stable list of probabilities.

    I picked approximating iterations for any input, and it passes all test cases within 0.08s. That's Python.