Monday, May 21, 2018

Being an interviewer: Copy linked list with a random pointer

May 21, 2018

Introduction


I was surprised to get contacted by a friend's friend and it is from another country Australia. I was so surprised to learn that. I have a new hitting partner to practice algorithm and data structure.

I spent first 20 minutes to share my experience of learning first. Here is the gist I documented, the note is kind of messy, next time I will write more clean and make it more readable.

Mock interview algorithm


I gave an algorithm for the peer to work on. Here is code and then my code for copying the singly linked list with next pointer.

The peer spent over 10 minutes to write a function using iterative solution, and then I also gave my code with some explanation.

Random pointer handling


The peer also worked on the random pointer, I had to ask her to give me her idea first before she wrote the code. And then she found out that she had some issues to figure out how to do the work.

Here is the transcript.

No comments:

Post a Comment