题解 | #数组中重复的数字#
数组中重复的数字
https://www.nowcoder.com/practice/6fe361ede7e54db1b84adc81d09d8524
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param numbers int整型一维数组 # @return int整型 # class Solution: def duplicate(self , numbers: List[int]) -> int: # write code here if not numbers: return -1 for x in numbers: if not isinstance(x,int): return -1 numbers2 = list(set(numbers)) for x in numbers2: numbers.remove(x) print(numbers[0]) return numbers[0]