You are viewing a single comment's thread. Return to all comments →
c++ solution: int saveThePrisoner(long long n, long long m, long long s) { if((s+m-1)%n==0) return n; else return (s+m-1)%n; }
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 →
c++ solution: int saveThePrisoner(long long n, long long m, long long s) { if((s+m-1)%n==0) return n; else return (s+m-1)%n; }