Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

contains duplicate leetcode solution javascript

var containsDuplicate = function(nums) {
    const map = {}
    for(const num of nums) {
        // If we have seen this num before return true
        if(map[num]) return true
        map[num] = true
    }
    return false
};
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #duplicate #leetcode #solution #javascript
ADD COMMENT
Topic
Name
6+8 =