Contains Duplicate

原创 2015年07月09日 22:33:26
public class Solution {
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> temp = new HashSet<Integer>();
        for (int i=0; i<nums.length; i++){
            temp.add(nums[i]);
            if (temp.size() != i+1){
                return true;
            }
        }
        return false;
    }
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

220. Contains Duplicate III

Given an array of integers, find out whether there are two distinct indices i and j in the array s...

leetcode--Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return t...

[LeetCode]217-Contains Duplicate 几种解法

数组重复元素查找: 解法一 :sort 后相邻位比较  40ms class Solution { public: bool containsDuplicate(vector& nums)...

【leetcode题解】【再看一遍】【86】【M】Contains Duplicate III

Given an array of integers, find out whether there are two distinct indices i and j in the array suc...

《leetCode》:Contains Duplicate III

题目Given an array of integers, find out whether there are two distinct indices i and j in the array s...

217, 219,220. Contains Duplicate I, II, III

Given an array of integers, find if the array contains any duplicates. Your function should return ...

LeetCode------Contains Duplicate

题目简介 Given an array of integers, find if the array contains any duplicates. Your function should r...

LeetCode-217. Contains Duplicate (Java)

Given an array of integers, find if the array contains any duplicates. Your function should return t...
  • NOadu
  • NOadu
  • 2017-06-27 11:17
  • 102

leetcode_[python/C++逐步深入]_217. Contains Duplicate(深度分析位操作算法)

题目链接 【题目】 Given an array of integers, find if the array contains any duplicates. Your function sho...

leetcode之Contains Duplicate II 问题

问题描述: Given an array of integers and an integer k, find out whether there are two distinct indicesi...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)