public class Solution { public boolean containsDuplicate(int[] nums) { Map<Integer,Integer> mp=new HashMap<Integer,Integer>(); int len=nums.length; for(int i=0;i<len;i++) { if(mp.containsKey(nums[i])) return true; mp.put(nums[i],1); } return false; } }