@greghogg5: I would've failed this "Easy" Coding Interview -- Fast & Slow Pointers for Linked Lists #leetcode #coding #programming #codinginterview #softwareengineer #datastructures #datastructuresandalgorithms

Greg Hogg
Greg Hogg
Open In TikTok:
Region: CA
Wednesday 29 November 2023 13:00:00 GMT
51505
1980
37
16

Music

Download

Comments

thebasilisk5
Roko’s basilisk :
The irony of all these algorithms is that you will almost never use them. And if you do you’ll end up looking them up anyway so you’ll never implement
2023-12-04 13:50:08
96
chicoandpaz
💃🏿 :
Isn't fast.next.next just going to become itself? 5 points to 4 which points to 5. Fast pointer will never hit 4.
2023-12-09 02:47:14
0
jorgeperezg9
Jorge :
I look everything I need up online at my job.
2023-12-07 03:59:35
1
ooumpalooompa
Bigfoot69 :
First solution is not o(n)
2023-11-30 18:06:18
2
aplusse
u :
Add a visited property.
2023-12-05 04:29:25
0
user2939207417197
Cedric :
you can use Tarjan's strongly connected components algorithm, which does have real world applications. but you don't get constant space complexity.
2023-12-06 07:32:00
0
dykshmall
Menacekus :
but if the last one doesn't connect to anything, it crashes on because None has no attribute next right?
2023-12-05 01:03:19
1
executesixtysix
executeorder66 :
will not work for infinite loops or double jointed lists
2023-12-19 19:01:06
0
nholdg
nholdg :
This only works if the cycle doesn’t go back exactly 1 pointer…
2023-12-04 12:23:54
3
codesamurai73
Tony V :
I had to answer this on a quiz in my second CS class in C - easy but at least useful as it gets you thinking about code design and bugs.
2023-12-18 04:14:15
0
illquiescent
fabian :
how do you not get a null pointer exception?
2023-12-01 10:50:07
4
dcj2489
dcj2489 :
Correct me if I’m wrong but I beleive if 5 points to 1 it wouldn’t work as it will try to set the slow pointer to 5.next which is null
2024-01-25 14:55:40
0
theeb_b
Theev :
Your voice sounds exactly like Jacksfilms
2023-12-18 10:01:05
0
wallzjon_12
Jon :
👍
2023-12-21 16:17:56
0
josephdel0ng
joseph.eth :
Yeah that algo sucks imo. Because you are using two generators in a set of size n. No guarantee they ever collide
2023-12-04 04:07:25
6
beeegyoshiii
beeegyoshiii :
such a stupid fucking question.
2023-12-04 06:02:46
3
punejap
Punejap :
if (tail.next). youre welcome. if you don't have a pointer to tail or you have a recursive loop idk what to tell you other than 'stick to python n00b'
2023-12-05 09:59:22
1
dhd.hre
Dhd Hre :
Given head 😞
2023-12-04 13:07:48
0
seedkey
seedkey :
It’s a trick you just need to know, same with finding the middle of a linked list
2023-12-01 19:50:35
44
kinchdeadalus
kinchdeadalus :
write a function which iterates over the list until it reaches the end. then write a function which determines if a function ends for an given input.
2023-12-27 17:08:00
0
To see more videos from user @greghogg5, please go to the Tikwm homepage.

Other Videos


About