标签:ring mos lin style solution div color item leetcode
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
标签:ring mos lin style solution div color item leetcode
原文地址:https://www.cnblogs.com/asenyang/p/12041714.html