首页 > 其他 > 详细

leetcode1286

时间:2019-12-15 10:18:20      阅读:84      评论:0      收藏:0      [点我收藏+]
 1 class Solution:
 2     def findSpecialInteger(self, arr: List[int]) -> int:
 3         n = len(arr)
 4         dic = {}
 5         for i in range(n):
 6             if arr[i] not in dic:
 7                 dic[arr[i]] = 1
 8             else:
 9                 dic[arr[i]] += 1
10         mostvalue = 0
11         mosttime = 0
12         for k,v in dic.items():
13             if v >= mosttime:
14                 mosttime = v
15                 mostvalue = k
16         return mostvalue

1287. Element Appearing More Than 25% In Sorted Array

leetcode1286

原文:https://www.cnblogs.com/asenyang/p/12041714.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!