题解 | #孩子们的游戏(圆圈中最后剩下的数)#
孩子们的游戏(圆圈中最后剩下的数)
https://www.nowcoder.com/practice/f78a359491e64a50bce2d89cff857eb6
class Solution { public: int LastRemaining_Solution(int n, int m) { int res = 0; for (int i = 1; i <= n; ++i) { res = (res + m) % i; } return res; } };