Showing posts with label round daisy. Show all posts
Showing posts with label round daisy. Show all posts

Tuesday, April 24, 2018

Being interviewee: Busiest time in metro town

April 24, 2018

Introduction


It is the algorithm I like so much called linear scan algorithm, by checking next row to make sure that current time stamp is the last row to finalize count of people left in the mall.

Mock interview


I had good time to write and test the code. I tried to write down some notes before I wrote the code in the mock interview.

Here is my C# code. Here is my feedback.



Being interviewer: Sudoku solver

April 24, 2018

Introduction


It is so interesting to meet the peer second time in less than a week. I had good time to learn Go language through the peer's performance. One major advice I had after the peer ran the web compiler test cases is to add back tracking on line 35, so the code could pass all test cases. I explained to the peer that parent node will ask child node to back track the element to its original dot value since parent node will try its next option.

Mock interview


This mock interview is so much fun, since last time I was complained not to give out any hint, leave first 30 minutes for the peer to reach his full potential. The peer gave the time complexity analysis and mentioned that he learned the recursive tree through cracking code interview book.

Here is Go code I reviewed, which also passes all test cases.


Sunday, April 22, 2018

Being an interviewee: Array quadruplet

April 22, 2018

Introduction


It is my favorite algorithm called array quadruplet. I did talk about the analysis of the algorithm and then wrote down the algorithm without any bug and pass all test cases first time. Only thing I did is to include library using ..., I explained to the peer that I have worked on the algorithm multiple times, but one time a young lady who was preparing facebook onsite, she told me that I should simplify the code to check if dictionary contains key or not. So I only need to write three lines of code from line 57 to line 62, before I need to write if/ else and then update list in both cases.

Mock interview


Here is my C# code.

I still remembered that the first time I worked on the algorithm on mock interview platform. I had such difficult time. After I worked with over ten people on this algorithm, I followed every peer and understood how they think and analyze. So it is also very good experience to help the peer to work on the algorithm the first time. Here is the blog I wrote to give the feedback to the peer. 





Being an interviewer: BST inorder successor

April 22, 2018

Introduction


It was my 6:00 pm mock interview. I had chance to help the peer to come out the solution in 40 minutes. I enjoyed to be an interviewer and then helped the peer to come out the optimal solution.

Sometimes it is so relaxing to watch how the peer worked hard, and then took hint quickly and reached the optimal solution.

Feedback


Here is the feedback I wrote on mock interview platform. I like to encourage the peer to work hard.

Things you did well

The peer took the time to think about the solution, started from inorder traversal and then moved to optimal solution by going up or down through height of tree to search. The peer wrote the code with bugs, and then worked on cleaning and removed all bugs and redundant code. 

Good thing the peer did is to stay calm, and also very good communication with the interviewer. The peer took hint quickly and then worked on the detail. It is very good to be able to come out the correct solution first time. 

The peer tested code with four test cases and make sure that the code works perfect. 

Things you should work on

Recommend the peer to work on more mock interviews. There are a lot of talent people out there, you will meet a lot of peers and then find ways to improve and go above the average performance. Work hard! 

You as an interviewer

I presented two solutions, and then the peer chose one for me to write. Also the peer asked a few questions and I think that the peer is very curious and like to improve. Good to work with the peer. 

Saturday, April 21, 2018

Being an interviewer: Sudoku solver

April 21, 2018

Introduction


It is challenge for me to train myself to be an excellent interviewer. I noticed that I checked wechat and read my own blog while the peer worked on C++ code. The first 30 minutes the peer could not pass all test cases, I told her that I am not in the rush, let me review her code and find the bug together.

The problem is that I should give the peer hint every step she writes the code, and point out the bug in her process. But the peer was trained and advanced to ICPC national contest in Brazil, and she wrote the idea kind of new to me. I let myself skip the whole process, and then catch up last minute how the code works. Specially she got some help from a friend to play world contest of ICPC.

Mock interview


Here is C++ code. I learned a few things about C++ through mock interview. The peer told me that in C++ 1 means false.

I ended up talking to the peer one hour 40 minutes. She is preparing Microsoft onsite interview in May. I definitely learn a few things through her practice. I understand that ICPC contest is really good tool to help students to advance their problem solving skills in quick and efficient ways, specially before they start to work full time as a software programmer.

Highlights of code review:
1. line 6, k argument is not meaningful, it should say something like digit.
2. line 14, the peer mixed col/3 with row/3.
3. line 61, the peer told me the failed test has two 9 in the same column, so the call of fill should be checked and return false if the duplicate is found.


Being an interviewee: Leetcode 10: regular expression matching

April 21, 2018

Introduction


It is hard level algorithm called Leetcode 10: regular expression matching. I had a mock interview 8:00 PM and the peer told me that I should hurry and complete everything in 30 minutes. I did finish coding and ran my own test case. But my code failed last test case "abaa" with pattern string "a.*a*".

Mock interview


I had difficult time to play with dynamic programming table. I have to match the index of text and pattern string to the dynamic program table, and then I need to build the recurrence formula.

Being a programmer, I learn to be patient again since I could not memorize the thing. I have to make mistake first and run a few simple test cases and fix the bug.

Here is my C# code.

The first twenty minutes was so exciting and nerve breaking. I just write down what I like to do. For example, I wrote something like // base case "" match "a*" or "a*b*", and then I can write code by looking up the comment.

I confused myself about -1, so I wrote down on line 20 as a comment, // pattern[col - 1].  Because I cannot declare an explanation variable because it may be out-of-range of the array. On line 21, I wrote down dp[0, col - 3] which should be dp[0, col - 2] because I confused dp table index with pattern string index.

It is kind of training I like under stress, work on whiteboard, and also work on communication with the peer, manage the peer to make sure the whole process is up to standard.

I wrote a comment like the following:
// base case "a" does not match "" - do not need to do anything - default false

Good thing I did in the mock interview is to run a few simple test case first. When I ran the test case "b" match "b*", I ran into index-out-of-range error, so I fixed the bug on line 21.

My code passes all four test cases I wrote, but failed mock interview platform test case: "abaa", "a.*a*".

Bug fix 


Here is the code I fixed the bug. All my practice on Leetcode 10: regular expression matching can be looked up here.

Please compare my last practice March 29, 2018, here is the blog.

How to deal with tough interviewer?


I had a peer who has more than five year work experience at Microsoft. He is very strict on time limit 30 minutes, so I was in the rush to complete the code and run test cases. At the end of 30 minutes, the interviewer told me that he was very happy for my performance, and he thought that I should be able to fix the bug quickly.



Being an interviewer: Decrypt the message

April 21, 2018

Introduction


It is 12:00 PM mock interview. The peer worked on the algorithm called Decrypt the message. I noticed something is different. The way the peer presented the algorithm is so clear and then I know that I met a very talent programmer.

Mock interview


I also joined the analysis of the algorithm with the peer. We talked about the difference between those numbers on line 8 and line 9.

Here is the analysis and python code. The peer managed to pass all test cases.