You are viewing a single comment's thread. Return to all comments →
C++ Solution:
int saveThePrisoner(int n, int m, int s) { int warn = 0; warn = (m+(s-1)) % n; if(warn == 0) warn = n; return warn; }
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Save the Prisoner!
You are viewing a single comment's thread. Return to all comments →
C++ Solution: