You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The index of last prisoner who gets the last piece of candy is m + s - 1 .
// But if this index becomes larger than the number of prisoners , then we have to start traversing from the beginning (since we are moving in a circle), hence it is required to find modulus of this sum.