A token moves on states 0 to N, stepping down with probability Q/P and up otherwise; find the probability of ending at N and print it modulo 1e9+7 as a reduced fraction.
Medium6Dynamic programmingProbabilityMathInterviewNo attempts yetTime limit1sMemory limit512 MB