Skip to content

Latest commit

 

History

History

217-Contains-Duplicate

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

217. Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.

题意

给你一个数字数组,判断有没有重复元素,有就返回true,没有返回false

方法(一)

将数组转换成Set,看两者的长度是否一样。