Monday, December 25, 2017

Swap technique applied to search minimum missing number

Dec. 25, 2017

Introduction


It is almost 2 hours mock interview. I had chance to practice the algorithm to use swap technique again. And then the peer asked me to write the optimal solution as well.

I wrote the solution, and did the white board testing. Run the code and there is a dead loop, timeout.

Code review


The C# code is here with constraint "The array cannot be changed".

The C# code is here with the permission to change the input array.

Follow up 


The C# code can be optimized for the case to change the input array. The code is optimized and the link is here.

How to work with graduate student?


It is learning experience for me to work with the peer today. I learn that if I treat the peer with patience and great attitude, then the peer will treat me with patience as well. Just be patient and learn some C++ through mock interview today. 




No comments:

Post a Comment