Open meishaoming opened 4 years ago
https://leetcode-cn.com/problems/the-masseuse-lcci/
下午做过一遍与这个相似的题, #82
一遍就写出了解法,比下午写的简法要更简洁。
class Solution: def massage(self, nums: List[int]) -> int: a, b = 0, 0 for x in nums: a, b = b, max(a+x, b) return b
https://leetcode-cn.com/problems/the-masseuse-lcci/
下午做过一遍与这个相似的题, #82
一遍就写出了解法,比下午写的简法要更简洁。