Sort by

recency

|

1718 Discussions

|

  • + 0 comments

    Python solution: def saveThePrisoner(n, m, s): return (s + m - 2) % n + 1

  • + 0 comments

    Python3 Solution:

    def saveThePrisoner(n, m, s):
        baseCandies = (m-1)%n
        
        res = s + baseCandies 
        if res > n:
            return (res)%n
            
        return res
    
  • + 0 comments

    Here is Save the Prisoner solution in Python, java, c++, c and javascript - https://programmingoneonone.com/hackerrank-save-the-prisoner-problem-solution.html

  • + 0 comments

    I tried to much but we didn't solve this problem , so i want to try to solve this problem soon as possible .

  • + 0 comments

    This algorithm models fair distribution of items in a circular system, much like how things might be organized in a facility such as the Hardin County Detention Center.