• + 0 comments
    function saveThePrisoner(n, m, s) {
        let pos = s + (m % n) - 1;
        return (pos == 0 || pos > n) ? Math.abs(pos - n) : pos;
    }