Monday, April 23, 2018

Being interviewee: Find smallest length of subarray

April 23, 2018

Introduction


I spent 30 minutes to write a brute force solution and I learned something from the interviewer.

Mock interview


Here is my C# code.

Follow up after mock interview


My mock interview experience is very good learning experience. First of all I made a mistake on brute force solution. The subarray should start with value equal to first element of target value, and the last value should be equal to the last element of target array. 


What I did is wrong. Any position of the array can be start of subarray, any position of the array bigger than start value can be the end of the subarray. I did not consider the target value to filter out those unmatched values. 

The time complexity of brute force should be O(n^2) instead of O(n^3). 

After line 76, I should add one more statement.

77   break; 


What if



It is the first time I experienced the strong connection to one of peers I met on mock interview. Since we practiced mock interview together more than three times, I know that he is my best connection right now.

It does not matter how good I am, if I keep meeting strong players on the market to prepare next important phone interview or onsite interview, I will definitely learn how to catch up to match the skills of peers.

This year 2018 is so special. First three months I experience over 10 people to prepare for Google onsite or phone screen, I did tell myself calm down, and learn from those peers, and also ask myself what to work on. I remembered that I thought about a dynamic programming algorithm while I took skytrain to Vancouver donwtown Microsoft to attend a hackerthon event, I was busy thinking about the solution.

My training of 2018 first 3 months are top of world classical training, I only used two mock interview platoform and then I connected to peers over the world. I believe that best of training or education of algorithm and data structure I got for myself is such revolutional, and help me to gain so rich experience.

It is most exciting part of my life as an adult last 8 years.

No comments:

Post a Comment