A Markov chain describes probabilities of transitioning between states. Given a starting state, transition probabilities, and a number of steps, simulate the chain and return the count of visits to each state. Input: first line start state and num_steps, second line n (number of transitions), then n lines "from to probability", then seed. Output: counts for each state visited.
Example 1:
Constraints:
1 <= num_steps <= 10^4 States are single lowercase letters 0 < probability < 1 Probabilities from each state sum to 1
Tags:
