- 找出转圈游戏输家
my solution 100% pass
class Solution:
def circularGameLosers(self, n: int, k: int) -> List[int]:
seen = set()
now_num = 1
step = 1
seen.add(1)
while 1:
stepSum =step*k
total = now_num +stepSum
now_num = total % n
now_num = n if now_num == 0 else now_num
if now_num in seen:
res = []
for i in range(1,n+1):
if not i in seen:
res.append(i)
return res
break
step+=1
seen.add(now_num)
- 矩阵中移动的最大次数