题目:
class Solution {
public:int lastRemaining(int n, int m) {int pos = 0;for(int i=2;i<=n;i++){pos = (pos+m)%i;}return pos;}
};
作者:想吃火锅的木易
链接:详细题解
来源:力扣(LeetCode)
题目:
class Solution {
public:int lastRemaining(int n, int m) {int pos = 0;for(int i=2;i<=n;i++){pos = (pos+m)%i;}return pos;}
};
作者:想吃火锅的木易
链接:详细题解
来源:力扣(LeetCode)