Save the Prisoner Hackerrank problem solution coderinme

Published: 04 August 2017
on channel: Coder In Me
2,716
16

A very popular competitive coding challenge in which we have to save the prisoner. Not in real guys, just for this challenge.So here we are A jailer want to distribute some(e.g 5 ) sweets to number of prisoners (6). All the prisoners have id from 1 to n and are sitting in a circular way, sweet can be distributed from anywhere (from the 2nd prisoner). But Last sweet is poisonous we have to warn that prisoner who will eat last sweet.