Search
⌘K

Leetcode 808. Soup Servings

Compute the probability that soup A is emptied before B (counting ties as half) under a random process of four equal-probability pours that reduce A and B by {100,0}, {75,25}, {50,50}, {25,75} mL until one or both hit zero. Solve it as a recursive/DP probability on the remaining volumes (commonly discretized in 25 mL units) with memoization and base cases for A<=0 or B<=0 (with an optimization that for large n the answer approaches 1).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.