Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 882032a

Browse files
committed
2020-03-29
1 parent 260cc00 commit 882032a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution(object):
2+
def lastRemaining(self, n, m):
3+
"""
4+
:type n: int
5+
:type m: int
6+
:rtype: int
7+
"""
8+
if n == 1:
9+
return 0
10+
return (self.lastRemaining(n - 1, m) + m) % n

0 commit comments

Comments
 (0)