leetcode 1046. Last Stone Weight python
1046
题意: 找出数列中最大的两个值且删除,大减小,若不为零则加入到数组,若为0则都删除
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
while len(stones) > 1:
stones.sort()
m = stones[-1] - stones[-2]
ston
原创
2021-03-29 10:31:07 ·
216 阅读 ·
2 评论