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

 

posted on 2019-12-15 01:16  Sempron2800+  阅读(137)  评论(0编辑  收藏  举报