剑指Offer 62

 1 # -*- coding:utf-8 -*-
 2 class Solution:
 3     def LastRemaining_Solution(self, n, m):
 4         if n == 0:
 5             return -1
 6         if n == 1:
 7             return 0
 8         dp = [0] * (n+1)
 9         dp[0] = -1
10         dp[1] = 0
11         for i in range(2,n+1):
12             dp[i] = (dp[i-1] + m) % i
13         print(dp)
14         return dp[n]
15         # write code here

 

上一篇:Keras猫狗大战四:数据增强+添加dropout层,精度达83%


下一篇:不要62