public bool ContainsDuplicate(int[] nums) { var hashSet = new HashSet<int>(nums); return hashSet.Count != nums.Length; }