Introduction
It is medium level algorithm. I came cross the algorithm in one of mock interview on Leetcode.com recently I had hard time to understand the problem, since I misunderstood the problem with node adjacent list. I worked on a much hard problem. This is my common mistake. Once I mistunderstand the problem. I even could not classify the problem as a simple depth first search algorithm.
My practice
Once I understood the problem, I also could not understand the depth first search algorithm shown in discussion post. So I asked the algorithm in mock interview on May 20, 2019. the interviewee worked on graph database and he is so confident on graph algorithm.
I learned how to solve the problem using depth first search again.
Here is my C# practice using depth first search.
Here is my C# practice using union find algorithm.
No comments:
Post a Comment