分糖果(凑字数)
作者:互联网
class Solution:
def distributeCandies(self, candyType: List[int]) -> int:
n = len(candyType)/2
candyType1 = set(candyType)
if len(candyType1) >= n :
return int(n)
else :
return len(candyType1)
标签:set,return,int,candyType,len,candyType1,字数,糖果 来源: https://blog.csdn.net/lwewan/article/details/121091375