(Python) Optimized version: Given an integer array, determine whether there are duplicate elements. If any value appears in the array at least twice, the function returns true. Returns false if every element in the array is different.

Given an array of integers, check whether there are duplicate elements.

1. The function returns true if any value appears at least twice in the array.
2. If each element in the array is different, return false.

Example 1:

# 输入: 
[1,2,3,1]

# 输出: 
True

Example 2:

# 输入: 
[1,2,

Guess you like

Origin blog.csdn.net/qq_42349944/article/details/103100226