Master Data Structures & Algorithms For FREE at AlgoMap.io!
@anna-plink3 ай бұрын
Great explanation for slow and fast pointers 👍 My solution to this problem was to reassign each node's value to 'seen'. And if I come up to a node that has value 'seen', then it must be in a loop
@GregHogg3 ай бұрын
That's actually a great idea
@yvettcodesАй бұрын
I was solving this problem in the wrong way, but today I've learned about slow and fast pointers and how to use them. Thanks! Another successful solution :)
@tobinjoseph5469Ай бұрын
you and and neetcode should collab !
@praneetkomandur65764 ай бұрын
better than neetcode I cant even lie
@GregHogg4 ай бұрын
😂
@chandrakanthVenisetty6 ай бұрын
Great explanantion, really liking it so far. Concise solutions. Coming to this solution, I dont think we need to add a dummy node and start iterating from there, because as per Floyd's algo, they would eventually meet. In the example above, fast and slow would meet in second loop iteration, it's just more computation that's all. Let me know your thoughts.
@theSuitCat8 ай бұрын
Hey greg, was it always that easy for you to solve these problems ? I find it very difficult not to understan but to solve it on my own. btw your explanation is very good keep it up.
@GregHogg8 ай бұрын
Lol definitely not easy at first, don't worry:)
@DMcDy3 ай бұрын
Hi Greg! I'm just curious why create a dummy node at all? It seems like it works fine to just omit that and make slow = fast = head. Thanks for the video!
@praneetkomandur65764 ай бұрын
Can I ask you something Greg. Are we supposed to think of solutions like this without tutorials? I find that humanly possible. I feel like im memorizing blind75 with understanding aswell but Im not sure if I'd be able to do any other problems (unless they're easy hashmap ones) Am I cooked for interviews or will the interviews most likely have blind75 type problems
@GregHogg4 ай бұрын
It's okay to memorize for a while, often the blind 75 teaches new important algorithms that you wouldn't come up with on your own
@Infinitely162 ай бұрын
It's just the situation that tech interviews are at, and it will just keep getting worse unfortunately. It is of course not valid, fair, or correct to expect someone to come up with this solution within 45 minutes (or less, depending on if there are follow-ups). No one in the world would be able to do it. This algorithm was devised by a computer science researcher and has a mathematical proof. So the absolute, only possible way to use this as a solution, is to have seen and practiced it before. So it's just a question of "hey have you seen this specific question before?"