题解 | #数组中只出现一次的数(其它数出现k次)#
数组中只出现一次的数(其它数出现k次)
https://www.nowcoder.com/practice/5d3d74c3bf7f4e368e03096bb8857871
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param arr int整型一维数组 # @param k int整型 # @return int整型 # class Solution: def foundOnceNumber(self , arr: List[int], k: int) -> int: # write code here a = dict() for i in arr: if i not in a: a[i] = 1 else: a[i] += 1 if a[i] == k: del a[i] for i in a.keys(): return i