This video is a solution to Leet code 382, Linked List Random Node. I explain the question, go over how the logic / theory behind solving the question and finally solve it using Python code.
Comment below if you have a better solution to this problem!
Let me know if you have any feedback and don't forget to subscribe for more videos!
Time stamps:
0:00 Question Explained
2:15 Solution Explained
10:15 Python Code
Code:
https://leetcode.com/problems/linked-list-random-node/discuss/957886/Python-3-Solution-Explained-Reservoir-Sampling-(Video-%2B-Code)
More leetcode questions solved:
https://www.youtube.com/watch?v=O5yxoFS_diY&list=PLr9zbByiJa3Ua2AgTrdvot6AQ3b4CxWrF