Skip to content

Most Important Set Pattern (Interview Favorite)

Most Important Set Pattern (Interview Favorite)

Section titled “Most Important Set Pattern (Interview Favorite)”
const nums = [1, 2, 2, 3, 3, 4];
const unique = [...new Set(nums)];
console.log(unique);
// [1, 2, 3, 4]

Time: O(n) VERY COMMON INTERVIEW QUESTION