Saturday, October 28, 2017

Find the smallest substring that contains some given subset of characters

Oct. 28, 2017

Introduction


It is a long journey for me to come out the solution to pass all test cases. I did at least 4 or 5 time last 6 months to work on the algorithm called "Find the smallest substring that contains some given subset of characters". I posted the question on code review, link is here in Sept. 2017.

Today I had chance to interview a peer using the algorithm, I only can hear the voice no video, but I understood how tough the algorithm can be, specially for the first time player. The peer does not work on the algorithm before, and I worked with him near 50 minutes on the algorithm. First 20 - 30 minutes to work on the algorithm itself, I had chance to follow what he approached the problem. Next 20 minutes I asked him to write code so I can evaluate his coding skills and coding style.

The mock interview is such a nice place to meet people and figure out together how to improve technical skills. The conversation is interesting and also very gentle on the topics. I have to let the peer approaches the problem first, and then give some hint, and see how discussion can continue.

The peer is very diplomatic so I know that he must be an important role in his job. First he chose to use JavaScript to code the program, so I complimented him about he must know node.js framework.
Then I noticed that he wrote down some notes to show his logic thinking, it is very clear; he asked my feedback so I know that he is also very good listener.

Mock interview 


I found out that I always get best peer in the world, so I have to keep up with the peer about technical skills, help them to understand their strength and weakness. It is so interesting to have a mock interview.

The test cases discussed in mock interview are the following:
1. yxxz -> "yxxz"
1. xxyz ->"xxyz"-> "xyz"
2. slide window, two pointer technique
left pointer and right pointer
3. Move right pointer first, and then find a substring; and then move left pointer to make the substring smaller if possible.

For analysis, if the peer can come out the test case like the following: For example, for search string ['a','b','c'], source string "aefbcgaxy", the shortest string is "bcga", the peer has excellent analysis of algorithm, assuming that the peer does not work on the algorithm before. 


Julia's practice 



It is also a great idea to review my practices:
April 2015, blog is here.
April, 2017, it is documented here.
June 29, 2017, mock practice C# code is here.
Sept., 2017, it is documented here.
Code review is here.

Oct. 31, 2017
It took me three years to fully understand the algorithm and how to work out a perfect solution. This experience taught me how to treat others, more patient please. And this is the really great algorithm to evaluate the candidate the algorithm analysis and technical strength.

No comments:

Post a Comment