Thursday, April 26, 2018

Being interviewer: Leetcode 152: Maximum Product Subarray

April 26, 2018

Introduction


It was very nice experience to be an interviewer. I helped the interviewer learn a brute force solution first and then we had very good discussion on the optimal solution using dynamic programming. The peer is preparing Google phone screen, I may come cross a Google future employee this time.  I met a senior undergraduate student who also works full time for a startup company in silicon valley area.

Mock interview


Of course I could not tell from the person how good she will be, specially when a peer is undergraduate student. But it is very easy to communicate with the peer.

Here is JavaScript code we worked on together, around 60 minutes. I also had chance to learn JavaScript from the interviewee.

I also learned from the peer. I challenged her code using comment line 63, I told her that line 68, temp_max *= arr[i] * arr[j], and then she added a few lines of comments from line 64 to 67, and then I understood her idea to use dynamic programming. She fixed the bug, and line 68: temp_max *= arr[j], arr[i] is removed from the product.





No comments:

Post a Comment