You are viewing a single comment's thread. Return to all comments →
JavaScript evil solution:
function saveThePrisoner(n, m, s) { return (m-1 + s)%n || n; }
Taking advantage of 0 being a falsey value in JavaScript and short circuit boolean expression evaluation. ;)
Seems like cookies are disabled on this browser, please enable them to open this website
Save the Prisoner!
You are viewing a single comment's thread. Return to all comments →
JavaScript evil solution:
Taking advantage of 0 being a falsey value in JavaScript and short circuit boolean expression evaluation. ;)