Tuesday, March 6, 2018

Find smallest substring containing all keys

March 6, 2018

Introduction


It was so exciting to know that the peer got the algorithm when I booked the interview early this afternoon. I know that the algorithm is hard level, and definitely it is very interesting to learn how the peer will solve the algorithm, specially if the peer does not work on the algorithm before.


Code practice


I know that the hard level algorithm is biased for the people never working on before. So it turned out that the peer came out the linear time solution with optimal time complexity, but the design has flaw which could not find smallest substring.

This is the first time I evaluated the idea as the interviewer, and then I came out the counter example to explain the defect in the design on line 35.

What I saw is that the peer was very calm and approached the problem, and then wrote code ready to run the test cases.

Here is the code I reviewed. I also learn some technology and know more about react framework. I did spend 30 minutes on react course before the mock interview today.


No comments:

Post a Comment