217 Contains Duplicate
时间:2015-05-30 09:15:07
收藏:0
阅读:213
public class Solution { public boolean containsDuplicate(int[] nums) { HashSet<Integer> hs = new HashSet<Integer>(); for (int i : nums) { if (hs.contains(i)) { return true; } else { hs.add(i); } } return false; } }
原文:http://www.cnblogs.com/77rousongpai/p/4539784.html
评论(0)