leetcode1086
Posted asenyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode1086相关的知识,希望对你有一定的参考价值。
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
以上是关于leetcode1086的主要内容,如果未能解决你的问题,请参考以下文章
ZZNUOJ_C语言1086:ASCII码排序(多实例测试)(完整代码)
leetcode_1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_[二维前缀和](代码片段
1086. Tree Traversals Again (25)二叉树——PAT (Advanced Level) Practise