Sunday, April 29, 2018

Being interviewer: Root of a number

April 29, 2018

Introduction


It is my learning experience to be a nice interviewer to work with a second year undergraduate student who studies in NIT university in India. The peer asked me the hint to solve the root of a number, so I explained to him the algorithm using line 59 to line 66. The peer was very smart and then he came out the idea to apply binary search.

Mock interview


I was not a very nice interviewer, I surfed my internet to read something about system design interview. But later on I noticed that the peer wrote a very good binary search algorithm. Better than I did when I worked on binary search algorithm first ten times last year.

Just share the fact that I have worked on binary search algorithm over 50 times last 12 months.

But this time the peer and I worked together over five minutes, we could not find the bug. It turned out that Math.pow(base, n) call is wrong, base and n two arguments are switched in the order.

I could not believe that I need to train myself hard to do trouble shooting. I need to train myself to think logically.

Here is the transcript with C++ code. I was so patient and let the peer worked on the algorithm first 40 minutes or so.





No comments:

Post a Comment