分析:
大概意思就是需要间隔一个才能再次预约,然后取最大时间
代码:
1 class Solution(object): 2 def massage(self, nums): 3 """ 4 :type nums: List[int] 5 :rtype: int 6 """ 7 n = len(nums) 8 f=[0 for i in range(n+2)] 9 ans = 0 10 for i in range(2, n + 2): 11 f[i] = max(f[i - 1], f[i - 2] + nums[i - 2]) 12 ans = max(ans, f[i]) 13 return ans
标签:面试题,nums,int,range,17.16,ans,按摩师 From: https://www.cnblogs.com/ooooopppp/p/17357212.html