What is the logic behind problem Dhoni's bowler ?

link: Dhoni’s Bowlers’s The link:editorial for this question is showing 404 error. Where is the editorial for this question ? or can anybody explain the logic behind this problem , as I am not able to understand the submitted solutions for this problem.