
The problem is rated 1600 , and is based on graph theory and Spanning Trees.
The problem can be solved using simple observation and BFS with time complexity O(N+M).
The same problem can also be solved using DSU , but we will be solving this using BFS.
If you are beginner and want to study graph theory in detail , here are playlist i created for that
Graph Theory Part 1 :
Graph Theory Part 2 :
if you think my work is worth praise you can donate using google pay , phone pay , paytm
UPI : 8010248418@ybl
Problem Link :
You can follow me at
Instagram :
Github :
linkedin :
Thank you guys for watching and keep coding.
CodeNCdode
0 Comments