class Solution:
def LastRemaining_Solution(self , n: int, m: int) -> int:
# 烫手山芋, 队列实现删除元素
res_quene = list(range(0, n))
while len(res_quene) > 1:
for i in range(m-1):
res_quene.append(res_quene.pop(0)) # 出队入队
res_quene.pop(0) # 出队删除
return res_quene[0] # 返回最后剩下的