You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Create a set from the nums array. Since Sets only allow unique values, any duplicates will be removed.
3
+
constset=newSet(nums);
4
+
// Compare the size of the set and the length of the original array.- if the size of the set is smaller than the length of the original array('nums'), it means there were duplicates.
5
+
6
+
returnset.size<nums.length;
7
+
};
8
+
9
+
// Time Complexity: O(n); - adding elements to the Set & compare sizes
0 commit comments