Javascript Solution


  • 0
    var containsDuplicate = function(nums) {
        var hash = {};
        for (var i = nums.length -1; i >=0 ; i--) {
            if (hash[nums[i]]) {
                return true;
            } else {
                hash[nums[i]] = 1;
            }
        }
        return false;
    };

Log in to reply
 

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