I had 10:00 AM mock interview this morning and I had to work on flatten dictionary algorithm. What I like to do is to avoid memorizing the solution, but I like to learn something from this mock interview.
I cannot believe that I met a peer who had work experience in China, Amazon and Microsoft, :-) I found out after mock interview. But in the mock interview, I still have issues to write down the code, a few of them, I like to work with the talent programmer in 30 minutes. I spent at least 5 minutes to write down the analysis, and then worked on coding around 20 minutes. Last few minutes I worked on bug fixing, code cleaning. I ended my algorithm in 28 minutes.
Let me write down what issues I came cross in the mock interview. Here is my C# practice code with the analysis.
1. I need to look up stackoverflow, and then find C# code:
type check to see if value object is Dictionary<string, object>
2. I need to handle prefix function argument. The definition of prefix is kind of confusing, in algorithm analysis, I did not write down the detail of the design. But in mock interview, I had to play with the code, and then I had a few minutes discussion with the peer. And then I cleaned up the code, wrote three lines of code: line 36 yo line 39.
3. I need to move out the code related to newKey (line 23 to line 27) outside if statement line 29 as the peer advised. I need to remove the redundant code.
I could not believe that I like to practice mock interview, even this Saturday, I have to work on tax return, system design. I still book a few mock interviews to keep myself busy and learn something inside my small home office.