@greghogg5: A Silly Visa Interview Question | Leetcode 3046 - Split the Array #datastructuresandalgorithms #softwaredeveloper #softwaredevelopment #softwareengineering #leetcode #FAANG #programming #softwarejobs #code #java #datastructures #softwareengineer #software #Coding #javascript #coding #SoftwareDevelopment #python #javascriptdeveloper #javadeveloper #codingisfun #codinginterview #js #html #css #sql #Leetcode

Greg Hogg
Greg Hogg
Open In TikTok:
Region: CA
Saturday 16 March 2024 16:11:29 GMT
175456
5918
69
71

Music

Download

Comments

myko101ab
Michael Barrowman :
You don't even need to count the whole array. You can return False early if you hit a higher number
2024-03-16 17:08:31
233
its_the_doolster
Its_the_doolster :
simply loop through and count occurence of the current num. If that count becomes 3 return false else true.
2024-03-17 20:43:03
25
furt_tech
Furt_Tech Industries :
still got it wrong dammit im cooked
2024-04-09 02:08:03
64
anarchofunnyism
Liv :
Could also create 2 sets, then foreach item, if not in the 1st set, add it, else if not in 2nd set add it, else return false, return true at end of loop. Basically the same answer, I just like sets :3
2024-05-26 06:47:53
1
boofybath
pettertrippein :
this is actually an interesting problem
2024-04-08 18:16:26
28
ii8370
😅🤓 :
After discrete math, coding has been so much easier to understand and code
2024-04-19 09:14:49
1
evananan3
evananan3 :
just sort the list, if nums[i] = num[i+2] then it's not possible. Definitely not the fastest approach, but one of the simplest
2024-03-19 21:11:53
2
kaugesaar
Victor :
This is a great question for an interview. Simple, yet with many possible solutions and follow ups.
2024-04-09 00:02:12
8
lukehebbtok
lukehebb :
This isn’t a coding question. This is a thinking question
2024-04-08 04:28:40
3
armetron
Armetron :
it wasn't specified, but if the array is already pre-sorted you don't even need to count. you can just start at index 2 and compare it to i-2. If they match return false
2024-05-07 16:35:41
11
noosetime
Borisas :
U dont even need to do that, just have a hashset and if it already contains a value u want to add return false.
2024-05-04 07:24:42
1
whatever_central
mindthunderbolt :
okay but how do I get the arrays themselves? we need your help programmer man😅
2024-05-01 21:56:54
0
likey_15
Ishaan :
I don't think it's a dumb question, it's a cool thought process. Also you can more concisely express the idea as return max(counter.values()) <= 2
2024-04-29 04:49:09
0
iiridial
iiridial :
why iterate, max(counter.values()) is better
2024-04-11 18:35:25
0
damonmedekmusic
⚜DAMON MEDEK & the Dead Dolls⚜ :
is JS I think you could do new Set(array). that will only keep unique items.
2024-04-07 02:59:48
1
appleuser36838358
appleuser36838358 :
Len Vs Set Length if Len(list) > 2*len(set(list))
2024-03-19 04:24:15
22
z7dr111
Enigma :
how can I get so smart to think like this 😂
2024-04-09 02:33:37
0
moy.mp4
Moy :
Tbh I feel like this one would have a lot of follow ups and discussion of trade offs especially for space complexity. Just like how two_sum is easy until they ask ya to solve it in different ways.
2024-03-18 22:42:30
3
sasamisa1111
harliy quin :
do it in c if you are good enough
2024-04-07 00:12:06
5
tomsibsonauthor
Tom Sibson :
In mathematics, this is known as the pigeonhole principle.
2024-04-11 21:11:03
0
adospassos17
Adospassos :
Often times there is no preset question and engineers just pick what to ask
2024-04-09 22:32:07
0
nemo.omnes
kamil :
just use a set and return once there is a duplicate?
2024-04-09 19:50:16
0
.derradji
Derradji :
if (number from array is in array1) : add to array2; else : add to array1
2024-04-20 13:31:13
0
necrock
NecRock :
This doesn't seem like a "can you solve this" question but a "how do you solve this" question. Do you stick something naive or go for something more optimal? Do you ask questions?
2024-05-19 14:04:21
0
adrtazz
adrtaz :
Accumulator pattern?
2024-05-01 04:30:13
0
To see more videos from user @greghogg5, please go to the Tikwm homepage.

Other Videos


About