class Solution(object): def getMaximumGenerated(self, n): if n == 0: return 0 nums = [0] * (n+1) nums[1] = 1 for i in range(2,n+1): if i % 2 == 0: nums[i] = nums[i/2] else: nums[i] = nums[(i-1)/2] + nums[(i+1)/2] return max(nums)
因篇幅问题不能全部显示,请点此查看更多更全内容