@greghogg5: Noob Coder vs Douchey Dev #programming

Greg Hogg
Greg Hogg
Open In TikTok:
Region: CA
Monday 25 November 2024 17:03:26 GMT
61854
2530
70
31

Music

Download

Comments

drp3pper1024
LogicalArt :
Or, convert the list to a set. Check the length of the set == length of original list
2024-11-27 12:45:44
64
1ftm2fts34xtcy
1ftm2fts34xtcy :
you can also sort the array and check i+1 at each index, slower than hashing but faster than n^2
2024-11-25 17:36:53
43
prostefi1000
︎ :
Couldn't we do: "return len(nums)==len(list(set(nums))"
2024-11-26 12:05:31
23
sayonara_1st
chúng ta của tương lai :
return new HashSet(nums).Count != nums.Length;
2024-11-25 17:07:48
10
iyed.bouchamla
Iyed :
Return len(nums) == len(set(nums))
2024-11-25 17:59:17
9
alphaor05
Alphaor05🧢 :
Sorry, is this java
2024-11-25 17:18:45
7
maraali788
Krgirk :
if we turn array into set. Than compare len(). if it's different return true, else return False.
2024-11-26 10:34:19
3
masmc05
masmc05 :
return len(nums) == len(set(nums))
2024-11-25 19:06:01
2
razgriz2180
Raz :
Leet is cool and all but suuuuper unrealistic for normal stuff lol
2024-11-27 19:32:12
2
plruijunkass
plruijunkass :
I wish I had actually stdied computer science, not just learned as I go.
2024-11-27 02:01:44
1
ohwellvell
ohwellvell :
Setnums = set(nums), if Setnums == nums return True else: return False
2024-12-17 00:31:13
1
romhulio
罗曼 :
why need else after return😳
2024-11-25 17:30:00
1
flatcrab
flatcrab :
len(set(list))!=len(list)
2024-11-25 21:56:14
1
symnsez
SymnSez :
How about length of list compared with length (size) of set.. if equivalent, then no duplicates found?
2024-11-25 21:03:10
1
sak1yo
Sakiyo :
now do this in c++
2024-11-26 03:20:32
0
hareth1600
Hareth Saeid :
also you can use a frequency array
2024-11-25 21:33:44
0
maxbar00
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
greghogg5
Greg Hogg :
MASTER LEETCODE FOR FREE AT ALGOMAP.IO
2024-11-25 17:04:44
0
joshuakoudys
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
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
sanyikaayogamester
Márk :
🤩🤩🤩
2024-11-28 06:16:15
0
eoindudley
Eoin Dudley :
len(nums) = len(set(num)
2024-11-28 08:27:40
0
user1o111o11
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
Vhanasoge :
I don’t know any of this lol
2024-12-02 22:43:22
0
oigt_
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.

Other Videos


About