Skip to content

Commit 6a25c4f

Browse files
committed
2020-07-08
1 parent 51f75d5 commit 6a25c4f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

面试题16.11.跳水板/面试题16.11-跳水板.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ def divingBoard(self, shorter, longer, k):
66
:type k: int
77
:rtype: List[int]
88
"""
9-
res = set()
9+
res = []
1010
for i in range(k + 1):
11-
res.add(shorter * i + longer * (k - i))
12-
return sorted(list(res)) if k else []
11+
s = shorter * (k - i) + longer * i
12+
if not res or res[-1] != s:
13+
res.append(s)
14+
return res if k else []

0 commit comments

Comments
 (0)