标签:sel ems else pre solution ids etc col sum
1 class Solution: 2 def highFive(self, items: List[List[int]]) -> List[List[int]]: 3 n = len(items) 4 dic = {} 5 for item in items: 6 ids = item[0] 7 score = item[1] 8 if ids in dic: 9 dic[ids].append(score) 10 else: 11 dic[ids] = [score] 12 result = [] 13 for d in dic: 14 scores = sum(sorted(dic[d])[::-1][:5]) // 5 15 result.append([d,scores]) 16 return result
标签:sel ems else pre solution ids etc col sum
原文地址:https://www.cnblogs.com/asenyang/p/11029372.html