Introduction
It is a graph algorithm and I stumbled on the algorithm since I misunderstood the problem statement. The graph is given as adjacent list, each node from 0 to N - 1 has a list of adjacent nodes. But I made it a hard problem and misunerstood the adjacent list as the nodes with edge connected sequentially. I asked the algorithm in mock interview, and I took some time to learn from the interviewee as well.
Case study
The interviewee solved the problem perfectly. He explained to me the idea using the example, and also he wrote the code and tested it with two test cases. I walked through the code and he explained to me his design.
Java code is pasted here. Start ->
End ->
Code review
I did make a few changes based on the above code written by a very competitive programmer who worked on graph database before. He definitely demonstrated strong skills to analyze a graph algorithm. The whole process to analyze and write code took him less than 30 minutes.
I just could not believe that it is such good learning experience and I also got good feedback as an interviewer.
No comments:
Post a Comment