python 哈希表法有一处括号用错了: class Solution: def FindNumsAppearOnce(self , array: List[int]) -> List[int]: # write code here mp = dict() res = list() for i in range(len(array)): if array[i] in mp: mp[array[i]] += 1 else: mp[array[i]] = 1 # 遍历数组 for i in range(len(array)): if mp[array[i]] == 1: res.append(array[i]) return sorted(res)
点赞

相关推荐

牛客网
牛客企业服务