I want to know about the algorithm used to solve this problem PRSN. I saw some of the answers, I could able to understand that this problem was solved using dynamic programming, but what is the exact trick that solves the problem?

1 Like

Why don’t you search for “Bribe the Prisoners” on Google? It was a straight lift from Google Code Jam 2009. http://www.algorithmatica.com/bribe-the-prisoners/

2 Likes