摘要:
def singleNumber(nums): d={} l=[] for i in nums: if i in d: d[i]+=1 else: d[i]=1 for k,v in d.items(): if v==1: l.append(k) return l 阅读全文
摘要:
def topKFrequent(nums, k): dict={} result=[] for i in nums: if i in dict: dict[i]+=1 else: dict[i]=1 sortDict=sorted(dict.items(),key=lambda d:d[1],re 阅读全文
摘要:
import timedef consumer(name): print ('%s 开始消费...' %name) while True: commodity=yield print ('%s被%s消费了...' %(commodity,name))def producer(name): c1=co 阅读全文