C# Solution


  • 0
        public bool ContainsDuplicate(int[] nums) {
            Hashtable hash = new Hashtable();
            
            foreach (var item in nums)
                if (hash.Contains(item))
                    return true;
                else
                    hash.Add(item, null);
            
            return false;
        }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.