LCP 06. 拿硬币
为保证权益,题目请参考 LCP 06. 拿硬币(From LeetCode).
解决方案1
Python
python
# LCP 06. 拿硬币
# https://leetcode-cn.com/problems/na-ying-bi/
from typing import List
from functools import reduce
class Solution:
def minCount(self, coins: List[int]) -> int:
return reduce(lambda x, y: x + (y + 1) // 2, coins, 0)
if __name__ == "__main__":
solution = Solution()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14