leetcode-面试题-16.11-跳水板

题目描述:

 

 提交:O(n)

class Solution:
    def divingBoard(self, shorter: int, longer: int, k: int) -> List[int]:
        if k == 0:
            return []
        res = []
        for i in range(k,-1,-1):
            num = i*shorter+(k-i)*longer
            if res and num == res[-1]:
                continue
            res.append(num)
        return res

 

posted @ 2020-07-08 22:37  oldby  阅读(109)  评论(0编辑  收藏  举报