Monday, August 28, 2017

Recursive solution - Julia's most favorite game

August 28, 2017

Introduction



Recursive function is my most favorite game as a software developer starting from 8/28/2017 10:00 pm. I think that I reach the threshold of number of failures, and then today I had great experience to write a recursive function. 

It is hard for me to find the time to practice mocking interview in August. I was busy to catch up so many things in August, vacation, outdoor activities like tennis, walking after dinner, so in August 2017, I only practice six mocking interviews so far. Today I like to go back to mocking interview and choose 10:00 pm instead of 8:00 pm. I only had two mocking experiences using 10:00 pm.


Algorithm practice 


Here is my C# practice code, the code passes all test cases, in 30 minutes limit. The peer type two wow to express the surprise, excellent performance. The only thing was last 10 minutes the peer lost video connection, the peer typed the text to continue the process.

My last practice is documented here, and the C# code is here.

Highlights of issues:

1. How to handle edge case?
case 1: "a.b.c", last key should not be followed by the dot char
case 2: if the key is empty string, then dot char should be skipped.

line 36: design of variable newPrefix, first writing is newPrefix = key + ".".  The design has flaw, if the key is the last one, the dot char should not be concatenated.

It is 11:50 pm. I turned on the computer and then added some notes about the compile errors in my writing. Write down the compile error, and then work on type issue, in the next practice, I should not write any code on this algorithm with type compiler errors. I am really tired and sleepy.

The corrections are in three places:
1. Line 38, add Dictionary<string, object>
2. Line 45, add (string)

The advice I got from the peer:
1. Move static variable into the function, line 9;
2. Empty key should not be concatenated by dot char '.' by observing the last test case.


Actionable Item




It is very important skills to learn how to work with various levels of software programmer, I decide to reserve 10:00 pm as my mocking interview time every day. I believe that 10:00 pm is hard choice, too late and it takes extra work to get focus. It will be good choice to simulate tough situations in the work place.

Bible verse encourages me to work hard, specially when I am tired.

No comments:

Post a Comment