HackerRank 'Save the Prisoner!' Solution | MartinKysel.com
A jail has N prisoners, and each prisoner has a unique id number,S , ranging from 1 to N. There are M sweets that must be distributed to the prisoners. But wait—there's a catch—the very last sweet S is poisoned! Can you find and print the ID number of the last prisoner to receive a sweet so he can be warned?
Read full article from HackerRank 'Save the Prisoner!' Solution | MartinKysel.com
No comments:
Post a Comment