Wednesday, April 25, 2018

Being interviewee: Word count practice

April 25, 2018


It is my favorite algorithm but also it is hard to write a complete solution in 30 minutes. The algorithm is to lower the sentence, remove special char \', and then split words by delimiters such as chars in the string " .:;,!", and then save the words to the dictionary, and then sort them by value. From the dictionary, apply the sentence word order, save words in the bucket to apply bucket sort, and then output in descending order of value.

Mock interview

I tried to write the code and pass test cases in 38 minutes, but I could not make it. After the mock interview, I spent over 20 minutes to debug and fix bugs in two places.

Here is C# code written in today's mock interview 8:00 PM. On line 48, I need to remove the statement: if(item.Length == 0), actually the statement: continue is deleted by cleaning process; and on line 106, the word may not be in the dictionary.

And here is C# code written after the mock interview to fix the bugs.


It is such a nice experience to practice the algorithm with a software engineer from I was asked if I work for Microsoft since I choose to use C# programming language. I couldn't believe that the peer wrote the optimal solution quick and correctly. I just could not believe that I keep meeting a very talented programmer again, in an ordinary Wednesday. I spent 38 minutes on my algorithm, the peer spent less than 20 minutes on his algorithm meeting planner.

Action items

I need to design some drills for me to work on those algorithms similar to those mock inerview algorithm, play with the error message, so I can think about how to identify issues quickly once I read some error message.

Train myself to read the error message, and also get used to pinpoint the place by interpreting the error message correctly, specially for those error message without line of code information.

My ideal practice is to fix bugs in one minute. I should be able to quickly identify the code's issue.

No comments:

Post a Comment