A lot of people had a lot of question while solving
Peg Game problem @
Qualification Round of
Facebook Hacker Cup. Here is my understanding of this puzzle. I hope I'm right and my solution will be accepted.
Imagine a game board and try to get "boundary condition"...
where:
- blue arrows shows "far left" and "far right" cases;
- red arrows shows situation that will never happend (probability 0).
Also imagine "missing of a peg" situation,
where:
- blue arrows shows that ball goes forward to the bottom with the same probability as it has before.
Test case from problem description
1st test case from example input