题目:
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;
}
};
作者:想吃火锅的木易
链接:https://leetcode.cn/problems/yuan-quan-zhong-zui-hou-sheng-xia-de-shu-zi-lcof/solutions/178427/huan-ge-jiao-du-ju-li-jie-jue-yue-se-fu-huan-by-as/
来源:力扣(LeetCode)