首页
Java
登录
6mi
u
盘
搜
搜 索
Java
575. Distribute Candies
575. Distribute Candies
xiaoxiao
2021-02-28
62
class Solution(object): def distributeCandies(self, candies): """ :type candies: List[int] :rtype: int """ kind=collections.Counter(candies) candy=len(candies)/2
return min(len(kind),candy)
分糖果:要种类最多。
用hashtable来存种类,在可以取到多少个,然后取其中最小值
转载请注明原文地址: https://www.6miu.com/read-79325.html
技术
最新回复
(
0
)