How about length of list compared with length (size) of set.. if equivalent, then no duplicates found?
2024-11-25 21:03:10
1
Sakiyo :
now do this in c++
2024-11-26 03:20:32
0
Hareth Saeid :
also you can use a frequency array
2024-11-25 21:33:44
0
max :
Replace the set with an empty Boolean array of size MAXINT if memory isn’t an issue for that sweet DIRECT ACCESS 😂
2024-11-26 17:23:46
0
Greg Hogg :
MASTER LEETCODE FOR FREE AT ALGOMAP.IO
2024-11-25 17:04:44
0
Joshua Koudys :
interestingly, a sort then check for dupes is slow in Python while the set approach is fast. While in Rust, the sort is fast while the set is slow.
2024-11-27 16:38:56
0
dssfsuper2 :
a hashset is O(1) but the constant is high.Given relatively small numbers, a lookup table might be a greater option and given fast sort algorithms they may be better too
2024-11-25 21:00:25
0
Márk :
🤩🤩🤩
2024-11-28 06:16:15
0
Eoin Dudley :
len(nums) = len(set(num)
2024-11-28 08:27:40
0
Cedric :
Is the check “x in s” constant? Otherwise it wouldn’t be in linear time right?
2024-12-02 21:02:06
0
Vhanasoge :
I don’t know any of this lol
2024-12-02 22:43:22
0
oigt_ :
sets look easy, I always throw a HashMap at the problem. 🗿
2024-12-07 20:06:11
0
To see more videos from user @greghogg5, please go to the Tikwm
homepage.