filmov
tv
Linked List Cycle (LeetCode 141) | Full solution with demo | Floyd Warshall | Study Algorithms

Показать описание
A really interesting problem where you are required to determine if there is a cycle in a linked list. A loop/cycle is formed if one of the pointers in the linked list points to an internal node in the same list. There are a lot of ways to solve this problem and hence it is very important for interviews. The video explores how you can use a hash table to keep a track of unique nodes and then it demonstrates how the hare tortoise algorithm actually works. A dry-run of code in JAVA is also included.
Chapters:
00:00 - Intro
01:29 - Problem statement and description
03:46 - Brute Force approach to detect a cycle
07:55 - Idea behind an efficient approach (Rabbit/Tortoise method)
10:40 - Efficient solution (Floyd Warshall algorithm)
12:42 - Dry-run to detect cycle
15:02 - Final Thoughts
📚 Links to topics I talk about in the video:
📖 Reference Books:
🎥 My Recording Gear:
💻 Get Social 💻
#leetcode #programming #interview
Chapters:
00:00 - Intro
01:29 - Problem statement and description
03:46 - Brute Force approach to detect a cycle
07:55 - Idea behind an efficient approach (Rabbit/Tortoise method)
10:40 - Efficient solution (Floyd Warshall algorithm)
12:42 - Dry-run to detect cycle
15:02 - Final Thoughts
📚 Links to topics I talk about in the video:
📖 Reference Books:
🎥 My Recording Gear:
💻 Get Social 💻
#leetcode #programming #interview
Комментарии