@greghogg5: Medium Google Interview Question! - Destroying Asteroids - Leetcode 2126 #programming #coding #datastructuresandalgorithms #software #leetcode #softwaredevelopment #softwareengineering #softwaredeveloper #datastructures #softwarejobs #python #code #FAANG #SoftwareEngineering

Greg Hogg
Greg Hogg
Open In TikTok:
Region: CA
Monday 11 March 2024 13:39:35 GMT
70975
2085
44
60

Music

Download

Comments

ahmedwitdawaves
Halal D. Luffy :
I am not sure about this solution
2024-03-11 16:10:41
65
omri111111
Omri :
[9,11,1,1] mass=8, wouldn't your stack fail?
2024-03-11 15:55:27
41
wthelly182
wthelly :
can’t we do this using a minheap?
2024-03-12 05:10:44
1
simsim3145
simsim314 :
tgis wont work, if you pushed into stack some light asteroids and then a heavy one on top
2024-03-16 18:36:57
0
utocsal
Uto Csal :
this solution doesnt work, imagine the worst case, you could only eat initially the very last item, so now everything else is in the stack, you cant eat the top of the stack, but you could eat others
2024-03-19 16:08:30
2
nickme88888
Nick Ambrose :
Basically the days until higher temperature question
2024-03-11 19:55:34
0
kadomhala
Rae :
This might be the coolest interview question I’ve seen
2024-03-13 18:01:29
0
sam_nikolas
Sam :
When google becomes a space company then I will answer.
2024-03-14 16:41:55
0
lahashh123
Luis Emilio Juarez J :
Can’t we use a heap and pop until necessary?
2024-03-12 00:04:41
0
paulpalezzi
Paul Palezzi :
you crash through the stack several times, n times if anti sorted O(n²), 1 if sorted, maybe log(n) avg?!
2024-03-16 15:09:34
0
greghogg5
Greg Hogg :
Edit: the o(n) solution shouldn't work, but it passes the test cases anyway! Sorry about that!
2024-03-11 17:07:29
33
romhulio
罗曼 :
heap?
2024-03-11 18:06:10
7
thevarunparekh
Varun Parekh :
would the time ne O(^2)? with the nested while loop
2024-03-11 13:53:11
6
stepanfilonov
Stepan Filonov :
Yapper😳
2024-05-21 22:09:53
0
toxicman123456
Ken Adams :
Greedy problems, should sort the asteroid list like the first approach 😁
2024-05-22 04:01:01
0
mariuscomiati
mariuscomiati :
It is cool, but it is also wrong
2025-02-19 12:41:38
0
bennievaneeden
Bennie van Eeden :
Sorry. But I don't get it... What if you need something deeper down in the stack to overcome the mass?
2024-06-06 10:51:22
0
To see more videos from user @greghogg5, please go to the Tikwm homepage.

Other Videos


About