class Solution {
public boolean containsDuplicate(int[] nums) {
Arrays.sort(nums);
for(int i =0 ; i<nums.length-1 ; i++){
if (nums[i] == nums[i+1]) return true;
}
return false;
}
}
class Solution {
public boolean containsDuplicate(int[] nums) {
Arrays.sort(nums);
for(int i =0 ; i<nums.length-1 ; i++){
if (nums[i] == nums[i+1]) return true;
}
return false;
}
}
本文标题:leetcode 217 重复元素
本文链接:https://www.haomeiwen.com/subject/dspxgftx.html
网友评论