Showing posts with label better having a coach. Show all posts
Showing posts with label better having a coach. Show all posts

Thursday, May 17, 2018

Find height of tree - My third mock interview given by my coach

May 17, 2018

Introduction


It is my third mock interview this 8:00 AM. I had very good learning experience in mock interview. I started to learn how to communicate better to work with my coach. He also started to think about helping me to work hard to find bugs in my code.

Mock interview


Here is my transcript. I will write C# code with some test cases, and also try to use recursive function to get node's level of tree for each node starting from 0 as root node.

Coach's advice


Through the mock interview, I was told that there are several issues on my iterative solution. I made a few mistakes. And then I was told to think recursively. If the current node depends on parent's node in terms of height calculation, then it is better to write a recursive solution.

Here is recursive solution I wrote after the mock interview.

I still could not believe that I made a few mistakes, and even I used Visual Studio debugger to help me to troubleshoot the issue. I missed the line 115 to assign value to heightIds[index].

Iterative solution is hard to think



I spent over 30 minutes to write and debug the code, I had to fix my thinking process ending up nothing is calculated. I missed the base case when the node has parent with value -1, then the node's height is one.

Here is iterative solution in C#.

From the performance of this algorithm in the mock interview, I learned the lesson to write an iterative solution correctly is not easy at all. So many bugs and even I write using Visual studio I keep finding issues.

A few places to be corrected after the mock interview:

1. base case: line 126 - line 128
2. line 139, I like to break the list iteration as soon as possible. Make sure that only uncalculated nodes are visited.

I think that the solution may also be broken the time complexity O(N). It is hard to write iterate a solution.

Lesson learned


Think recursively, think memorization. Try to cut time to O(N) linear time.

Friday, October 20, 2017

China Open 2017 Quarter Final - Jelena Ostapenko

Oct. 20, 2017

Introduction


I went back to China and spent whole day on Oct. 6 to watch China open, one match I watched is for Jelena Ostapenko to play against Sorana Cirstea, a Romania ranking 37.

My favorite memory is the picture I took in the match. The coach of Ostapenko talked to Ostapenko in the short break of the match.




Quick catch up


Now it is the first day back to Vancouver after the vacation, it is 7:45 PM Oct. 20, 2017. I quickly looked up Ostapenko's coach and catch up more about the coach.

Here is one minute coaching video to show how the coach talked to Ostapenko. I like the coaching style.

One minute video is here called Ostapenko and Anabel Medina Garrigues. 

Here is the highlight of match - a quaterfinal match in China, I saw myself in the video to watch the game, video 4:18 - 4:20/ 5:06.

Jelena Ostapenko vs Sorana Cirstea Highlights China Open 2017



Actionable Items


I set a new wall paper for my cellular phone starting this Oct. 6, 2017. The picture of China open and the player Ostapenko. Actually it is the picture above I took to show the coach talking to Ostapenko in China Open. It just reminds me everyday no matter how good you are, you are always better to have a coach and get some insights.

Julia, it is better to write down 1 minute coaching from the above video:

Ostapenko and Anabel Medina Garrigues


"The problem is that you are not serving good, 35%; You are making a lot of unforced errors, so we have to, we have to miss (?) less, try to serve better.  0:20/ 0:55, you can play, of course, 6 to 1, do not say that. Do not say that. 0:24/ 0:55 When you are running, try to close the court. Do not open to her. 0:32/ 0:55 What I am doing here, you call me.  Try to complain or try to win the match. Because of that, you call me. Keep fighting, keep fighting. She is no. 6 in the world. She is not giving you the match. She will fight, you fight soon (?). And try to learn, this is good for you. "