We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 530f0b4 commit 5ac8b8bCopy full SHA for 5ac8b8b
面试题62. 圆圈中最后剩下的数字.js
@@ -0,0 +1,11 @@
1
+/**
2
+ * @param {number} n
3
+ * @param {number} m
4
+ * @return {number}
5
+ */
6
+var lastRemaining = function(n, m) {
7
+ let f = 0;
8
+ for (let i = 2; i != n + 1; ++i)
9
+ f = (m + f) % i;
10
+ return f;
11
+};
0 commit comments