Last updated 1 year ago
const map = {}; for (const num of nums) { if (map[num] === 1) return true; map[num] = 1; } return false
var containsDuplicate = function(nums) { return new Set(nums).size !== nums.length; };