I agree. But for this question, it made sense to understand optimal solution directly. However for most of the other questions, I go through brute force and then optimal.
Brute force approach: Go through each edge, try to remove that edge, see if all the other points are connected. If yes than removed edge was the redundant connection. If not keep trying for all the edges.
This is the first video where I'm learning about DSUs, though I've heard it multiple times before. The explanations were spot on as usual! Also the updated video format with the dark mode text editor, zoomed in view, readable comments and having the whole code written beforehand are a treat to the eyes! 🤍
Brute Force and then optimal solution. Not jump right to optimal solution. Its not natural I believe!
I agree. But for this question, it made sense to understand optimal solution directly. However for most of the other questions, I go through brute force and then optimal.
@@DestinationFAANG any chance of getting Brute Force solution for this?
Brute force approach: Go through each edge, try to remove that edge, see if all the other points are connected. If yes than removed edge was the redundant connection. If not keep trying for all the edges.
This is the first video where I'm learning about DSUs, though I've heard it multiple times before. The explanations were spot on as usual!
Also the updated video format with the dark mode text editor, zoomed in view, readable comments and having the whole code written beforehand are a treat to the eyes! 🤍
Thanks for the comment, and the previous suggestion to update the background as well.