loading...

Save the Prisoner Explain Solution | Javascript

hieusmiths profile image Minh Hieu ・1 min read
function saveThePrisoner(n, m, s) {
  console.log((m-1 + s) % n)
  return (m-1 + s)%n || n;
}

saveThePrisoner(3, 1, 2);

Problem

Discussion

pic
Editor guide