Thursday, May 31, 2018

Personality challenge

May 31, 2018

Introduction


I like to talk about software programmer personality as today's short research topic. I met a friend Tony today on tennis court, he knew me over 8 years. We talked about how he trained his daughter to be a professional tennis player. She is 14 years old.


My personality


I was given a lesson how to be a coach. Give room to the person. Let her grow and then figure out things by herself. Do not overdo.

I like to confess that I was too shy to make a mistake 8 years, one year ago.  I definitely improve a lot after I play hundreds of hours tennis. I learn from tennis sports.

I definitely get better after I had conversation with tennis coach.

Tennis workout

May 31, 2018

Introduction


It is time for me to go to tennis court and enjoy outdoor sports. I went out and had a good time on tennis court. I need to relax myself and work on some sports training.

My friend showed me how good his daughter is on tennis. His daughter is champion of 2018 ROGERS JUNIOR OUTDOOR NATIONAL CHAMPIONSHIPS. He showed me the website with her ranking point 9.

How to train a tennis player professional?


We chatted more about how to train the kid from age 5 to age 14, and how to train her to be a professional player.

I have known the tennis dad over 8 years. I saw how dad trains his daughter since she was less than 7 years old.






Sleepless in Bejing and early bird in Vancouver

May 31, 2018


Introduction


How can two people meet with such busy work and life? A young graduate will sacrifice sleep and meet 11:00 PM to 1:00 AM in Beijing, and an early bird in Vancouver will get up before 7:30 AM and prepare to be coached for three weeks drill. I think that the blog should definitely be called "Sleepless in Beijng and helps early bird in Vancouver".

It is such great experience to have a series of mock interviews from May 12 to May 31, 2018. We have met over 8 times in total connecting from Beijing to Vancouver. I could not believe that it is such an enjoyable thing to do. I will write down a few things I learn through the series of mock interviews.


Good partnership


I know that a good coach will work with different players. I enjoy the time to work with my coach. I start to know his personality and also very good hard working stories now. My coach is cool as the youngest tennis coach Daniel Vallverdu  who coaches ten 10 ATP player Dimitrov.

I always follow tennis professional players, one of favorites, Safarova, and think about getting a coach like Rob Steckley. My research topic is similar to surviving after 30. One practice I am done!



First blog:

Introduction to get help from a coach is written in a blog called special three weeks drill.


836 minutes working together


It is definitely a big number, 836 minutes, close to 14 hours. There are eight mock interviews in total up to May 29, 2018.


First interview ( 71 minutes)

Detail see my blog called first mock interview from my coach.


Second interview (108 minutes)

Minimum cost using dynamic programming - mock interview

The transcript is here written in mock interview. And the code is written after the contest.

Find least number of perfect square, the blog is here.



Third interview (101 minutes)

Next large element in the array, the blog is here.

Height of tree, the blog is here.


Fourth interview (114 minutes)

The mock interview is documented here. The algorithm is called ....


Fifth interview (124)

find string s2 containg s1 permutation, the blog is here.


Sixth interview (105 minutes)

Suggest a char with maximum occurrence at the position with the given prefix. The blog is here.

breadth first search algorithm - processed by layers. The blog is here.


Seventh interview (96 minutes)

union find algorithm is documented here.


Eighth interview (116 minutes)

Leetcode 91 Decode ways is documented here.

Isomorphic strings is documented here.

Extra algorithms discussed:


1. Second mock interview

My past practice on dynamic programming is here. Manhantan 2 booking woman is the algorithm to apply dynamic programming.

2. Ask code review for my mock interview performance on trapping rain water.

3. Discussion about hard level algorithm maximum disjoint subtree product




Get lost in a depth first search, DP, tree algorithm again

May 31, 2018

Introduction


It is my favorite thing to do if I have luxury to spend a few hours. I like to learn the algorithm again called Maximum disjoint subtree product.

I read my own blog written after the contest in May, 2017. I read the code I wrote in the contest, and I like to make any point above zero. I wrote more than one hour and three hundreds of lines code, but I still scored zero. The hard working spirit really touchs my heart again.

I do have to get a coach and learn better way to think in terms of depth first search, dynamic programming and tree.



Algorithm study


Here is the code I spent time to play with. I need to get some help from my coach. I like to learn how he solves a hard level algorithm.

Getting smart after 12 months

May 30, 2018

What I like to do is to solve a subproblem first. Assuming that there is an array, we need to find two disjoint subarray with the maximum product. I like to define two dynamic programming solutions, and then I solve the problem first.

Here is C# solution I write. Time complexity is O(N), N is size of the array.


Leetcode 205: Isomorphic Strings

May 31, 2018

Introduction


It is one of my mock interview algorithm given by my coach. I wrote a C# solution. I got hint to use array instead of using hashset.


Follow up 


July 20, 2018

I ran the code against Leetcode online judge using Leetcode 205. There is index out of range error for test case: "13", "42"

Need to fix the issue. The C# code is here to pass online judge. 

Cassadra Netflix case study

May 31, 2018

Introduction


I like to spend 30 minutes to study Cassadra Netflix.

Learning is so surprising. Originally I plan to read grokking system design lecture notes, and then try to memorize the solution.

But surprising my friend offered me coaching and then I had chance to go over complicated web architecture by first hand sharing. I was asked to read Cassadra Netflix after May 30, 2018 one hour coaching.

To be a good student and be coachable, I find that I am so enjoying to read Cassadra database and totally forget the time.


Scaling Time Series Data Storage — Part I


Reading is getting hard.

https://docs.datastax.com/en/cassandra/2.1/cassandra/dml/dml_manage_ondisk_c.html

write down new terms I need to learn:

Log-structured Merge Tree vs B-Tree

Read-before-write

statement: Cassandra never re-writes or re-reads existing data, and never overwrites the rows in place.

hard disks (HDD)
solid-state disks (SSD)

Tuesday, May 29, 2018

Being an interviewee : Insert intervals

May 29, 2018

Introduction


It is the interval algorithm but it is not easy for me to come out elegant idea to write simple code. I had some ideas, but before I came out the idea, I already wrote the code. The interviewer told me stop, and told me that I should make it simple.


Ideas 


Here is the transcript of the mock interview.

Hints pouring down 


I like the interviewer. He just quickly coached me through mock interview. I like to exaggerate how he did. He poured down hints one by one. I really like young talent Chinese graduate student, how hard he works, and he is willing to coach me. He did 3 times mock interviews with me, and this is the third time. I like his good collabration skills. I do believe that the future will be better with those young gradautes.

A few hints are given by the interviewer and the interviewer helped me to get the optimal solution and also very clean implementation:

1. About inserted interval, it can be replaced by current visited element
2. inserted interval can be replaced by the merge interval of two overlapped intervals.
3. Write simple code, I wrote the code to check next interval and logic is too complicated for the interviewer to follow. It may work, but the interviewer told me that it is better to discuss with the interviewer first.
4. The interviewer told me that it is better to ask hints, instead working on complicated solution. I do not totally agree on this.
5. If I am too busy to work on the code by myself, the interviewer may not have chance to work with me.

Follow up 


I wrote C# code and also I found a bug. Actually if I check my coding style and I should find the bug. Those two lines of code with variables insertedStart, insertedEnd, the scope should stay inside for loop. Now they are moved to line 60 and line 61.


Leetcode 94: Binary Tree Inorder Traversal

May 29, 2018

Introduction


I could not believe that I finally can write working solution using recursive solution today. It is quick and fast. I still remembered that I did choose to write a recursive solution, instead I wrote an iterative solution with some bugs on important meeting. This past 12 months I definitely have done some good training. I CAN write a recursive function very easily on binary tree.

I like to submit as many algorithms as possible on Leetcode.com.

Recursive solution


Here is my recursive solution.

Iterative solution


I like to go over the algorithm with tag stack. I wrote an iterative solution using stack, and it is good workout for me to master stack algorithm one more time.




Leetcode 91: Decode ways

May 29, 2018

Introduction


It is my eighth mock interview from my coach starting from 8:00 AM to 9:40AM on May 29, 2018. He asked me to work on Leetcode 91: Decode ways.


Mock interview


Here is code I wrote in the mock interview.

Follow up


I wrote the C# code and then tried to pass online judge. I made a mistake to put 0 which should be '0' on line 80.


Coach's advice


Please consider to define the array using extra one space. Let the first element of the array be empty, therefore in your solution line 80 index >= 1 can be removed.


Follow up 


May 2, 2019

I chose one of online mock interview on Leetcode.com and had chance to practice the algorithm one more time.

I spent 30 minutes to write and used debugger to help me to fix a few bugs in order to pass online judge.

Here are highlights:

91 Decode ways
I came cross three bugs and I had to use debugger to help me to figure out
1. mix char with integer, s[i] - '0' is to convert to integer
2. all results are zero, forget to increment one for the start
3. apply step 1 for all instances, miss a few place
4. missing edge case, tenth digit should exclude 0, 3 to 9. 0 is not considered by mistake.
5. missing edge case, 00 is not valid

And the code written is here to look up.




Monday, May 28, 2018

Deliver results

May 28, 2018

Introduction


It is one of Amazon leadership principles. I like to learn from the Amazon leadership.


Hava backbone: Disagree and commit

May 28, 2018

Introduction


It is one of Amazon leadership principles. I like to spend at least 30 minutes to study the principle first.


Dive deep

May 28, 2018

Introduction


Dive deep is one of Amazon leadership principles. I like to learn the principle and plan to spend 30 minutes at least.

Earn trust

May 28, 2018

Introduction

Earn trust is one of leadership principle. I like to spend 30 minutes to write a blog for this principle.

Frugality

May 28, 2018

Introduction


I like to write a blog for frugality principle. I think that frugality is hard to practice, it takes a lot of wisdom and determination. I like to apply the frugality principle to my daily job.


Bias for action

May 28, 2018

Introduction


I like to write a blog for Bias for action principle. I will start to work on it 10 minutes first.


Sunday, May 27, 2018

Find a system design coach

May 27, 2018

Introduction



I had this past Saturday system design study, I had a few times to feel so tired and sleepy. I know that I may have problems down the road. I need to find a coach. I start to search who will be my best coach.


First two hours learning 

May 28, 2018

I just could not believe that I had two hours training from my friend. Two hours learning makes big difference.

Here is my notes I took in the training.


Second time coaching


May 29, 2018

It takes time for me to get ideas how things work out. I need to work on one thing a time. That is the reason I got a coach No. 3, who has a lot of industry experience. Basically he went over grokking system design lecture notes and discussed with me. If I have any question, he gave me answers and make sure that I can understand the concept by his explanation. He could explain things so clearly and I totally quickly understand.


Content dilivery network:  CSS, spritemap

Amazon S3/ cloudfront

CDN -> Amazon /cloudfront

Shard -> horizontal/ row/ databases
range-based shard

sharding - horizontal, columns
Direct-based partition
partition key values
Index - sacrife the space to get shortest time
Explain SQL plan -> look up index needed or not
Proxy - reverse proxy
enforce/ request/ rule/ login information / map/ API - url reroute

Queue - RabbitMQ, producer/ consumer

Data/ service   logging shipping/ database server
microservice
Horizontal
encyms   Deployment/ encyms

SQL/NoSQL JASON    redis
NoSQL, structure/ unchange
Cassandra/ couchDB

HDFS or cluster FS

RAID - redundant array of independent disks

I/O in parallel - read/ write

RAID - cluster / Redundancy

I was strongly advised to look at open source tool called Swagger / OSI open specification

Go over netflix stream system design

7.  File processing workflow
8.  Data Deduplication

2. Range based partition

10 caching   Least recently userd (LRU)

RAID - partition key -> 256 buckets
Blob - save image

Elastic search - NoSQL search , document - tuning score, criterias: two words how close they are, subject

high speed cache - google CDN

8. Metadata sharding
Partition
user id    cassandra

Memcache   k-V memcache


Given an example about tag on video, threshold > 3,
caching 20%

Redis - can be applied to anywhere
Cluster -
Elastic search
Cassandra - big data handling, very good write speed
build index x ( problem to build index)


Storage - log/ by minute/ 60 seconds
search

Overall, learning is much better with a friend to go over the system design of Netflix stream, and I had chance to ask a few questions. I was not afraid to ask questions, and then the friend gave me very good experience based on his work experience. The time spent is 60 minutes.


My task is to understand those tools, and be able to freely apply them in the system design. Redis, swagger, Elastic search, Cassandra, load balancer, Amazon/ Google/ F5 load balancer. The coach shows me how easily he can come out ideas how to design step by step.



Sascha Bajin - my favorite coach

May 27, 2018

I like to learn from the coach and then share with my coach of algorithm, a young Tsinghua university graduate.

https://www.youtube.com/watch?v=1D_bj0YFEWc

Darrell Cahill - coaching philosophy

May 27, 2018

Introduction

One of things I like to do is to do some research and help my coach to give me coaching time. I like to write down notes from this three minutes coaching video. After that, I will send my coach an email.

https://www.youtube.com/watch?v=LyRJ5IvWjss


Best coach I knew and met in China open 2017

May 27, 2018

Introduction


I like to share some document with my algorithm and data structure coach. So I like to share this great coach talk video.

https://www.youtube.com/watch?v=LyRJ5IvWjss

https://www.youtube.com/watch?v=Pd5HRQWzB0I



Work with my coach (II)

May 27, 2018

Introduction



I need to write an email to my coach today. He gave me a coaching lesson this morning 8:20 AM to 10:20 AM. He did good job to coach me tough algorithm.

I need to send him a good video about Safarova about her coach - my favorite one Rob Kentaley.

https://www.youtube.com/watch?v=oI4ug17z1kA


union find algorithm - 7th mock interview from the coach

May 28, 2018

Introduction


It is my most favorite algorithm called union find algorithm. My coach asked me to solve the algorithm to find maximum group. We had discussion around 100 minutes. Through the discussion, the coach showed me how to do time complexity, and then we had good time to discuss a few topics. At last, I asked the coach to write two function, one is to quick find, one is to union.

Transcript


Here is the transcript of mock interview on May 27, 8:00 AM.

Follow up


I spent a few hours to review my past practice on this union find algorithm, and then I wrote C# code for review. Also I was asked to write a depth first search algorithm, and I will write one.



Breadth first search distributed algorithm - 6th mock interview from the coach


Introduction


It is my most favorite algorithm May 2018. I was surprised to spend more than one hour to write the C# code and also fixed my original design issue. My design was kind of weak until I tried to test the third test case with 4 x 4 matrix. I found out the answer is not correct. For some reason, the current layer of node will get into next round when I apply breadth first search. Later, I added a hashset to exclude the current layer node to get into next round.

The algorithm is so ineresting and I remmebered that I worked on the similar algorithm called shortest distance to all building.


Algorithm 


I wrote a breadth first search algorithm based on my coach's hint. Find all elements in the matrix with zero value first, put all of them in the queue, and then process breadth first search on those elements in the same time.

It is kind of distributed algorithm. I like the challenge. I feel excited after I complete the algorithm.

Here is my mock interview transcript.

Here is my C# code after mock interview.



System design

May 27, 2018

Introduction


It is time for me to read grokking system design articles. I spent a few hours this Saturday and I read a few system design, one is instagram design.

What I like to do is to design some drills to help me read carefully, think carefully, learn something as well.

It is not easy for me to learn something if the content is not very well prepared. So I chose to purchase grokking system design with payment over $100 Canadian dollars. I like to focus on the lecture notes and do some research based on the reading material.


Argument of day


Julia, do not be silly. You work so hard and finally can do very well on algorithm and data structure problem solving. Then you should work hard on system design. It should be easier compared to algorithm and data structure.

Prepare some notes, follow a few simple steps.

Study notes







Saturday, May 26, 2018

Think big

May 26, 2018

Introduction


It is my favorite thing to write a blog for one leadership principle called think big. Thinking small is a self-fulfilling prophecy. Leaders create and communicate a bold direction that inspires results. They think differently and look around corners for ways to serve customers.

Word by word


leaders -> directions -> results
customers -> serve customers -> ways to serve customer ->  look around corners for ways ...

a bold direction -> how to define a bold direction?

Relate to my experience


First I like to read the engineer's blog about Think big. Here is the link.


Insist on the Highest Standards

May 26, 2018

Introduction


It is time for me to learn leadership principle one by one. I like this one most since I know the difference to insist on the highest standards. 

Leaders have relentlessly high standards - many people may think these standards are unreasonably high. Leaders are continually raising the bar and drive their teams to deliver high quality products, services and processes. Leaders ensure that defects do not get sent down the line and that problems are fixed so they stay fixed.

Principle wording


rentlessly - 
high standards

unreasonably high 

leaders are continually rasing the bar

their teams to deliver high quality products, services and process

Insist on the highest standards

- highest standards -> what is the standards? how to define the standards? highest? How about high -> higher? 

leaders vs many people 

leaders -> their teams -> deliver high quality products, service and processes. 

How do leaders make the transition from insisting on standards level to delivering high quality ...

Relate to myself


I need to hold on highest standards. 

1. Push myself to master C# programming language from my own ranking 6 or 7 to 9. What I do is to read the C# book, ask questions, and memorize API. 
Every time I write C# code in mock interview, I ask question what problem I have on C# coding. I like to learn C# by checking the thinking process of basic problem solving. 

2. I like to ask questions on code review website and also make sure that I can easily get help if I need to work on some algorithm. I need to find out areas I can improve on C# code. 

3. I like to keep writing code every day, this way I can master the data structure and algorithm one by one. 

4. I believe that once I master the data structure and algorithm, I start to know how to make the products I architecture and code to high quality. 
Security - against attack
Code - readable, clean code
Code - simple code 
Code - object-oriented principle - try to apply to my own work 
Test coverage - 


Highest standards

- relate to my practice on Hackerrank contest, I continuously worked on the contest until I got my first gold medal. I documented every practice so that I review and find things to work on. I also try to train myself. 


Highest standards 

Hire and Develop the Best

May 26, 2018

Introduction


It is important that I have a friend who checks with me daily about my progress about leadership principle study. We have short chats through Facebook messengers. We started to chat more about leadership since I started to work with my coach. The friend used to be my hitting partner to work together on algorithm a few times. 

Hire and Develop the Best
Leaders raise the performance bar with every hire and promotion. They recognize exceptional talent, and willingly move them throughout the organization. Leaders develop leaders and take seriously their role in coaching others. We work on behalf of our people to invent mechanisms for development like Career Choice.


Understand the leadership principle first


Let us go over terms in the principle. 

raise the performance bar
every hire and promotion

recognize exceptional talent

exceptional talent -> how to recognize, how to measure exceptional? talent? what talent? basic talent or special talent. 

Leader move them throughout the organization. 

Organization -> business -> what kind of management in the business? 

Leaders vs coaches -> coaching others -> what motivations stay behind? 

on behalf of our people to invent mechanisms for development like career choice. 

It is hard to relate to my own practice. 

Please list a few mechanisms for development like career choice. Career choice, what other options do we have besides career choice.

Relate to my personal story


I hired best coach for my data structure and algorithm since May 12, 2018. I start to build some experience to have a good coach.



Follow up 


Oct. 18, 2019

Back in May 2018, I decided to hire a personal coach from one of top performers I met through pramp.com. I practiced over 300 times, and then one of players has super performance. He was a graduate student in Tsinghua university. So I decided to ask his help to prepare onsite interview from Amazon. 

Learn and be curious

May 26, 2018

Introduction


It is my most favorite topic of leadership principles. It is straightforward. Learn and be curious. As I am getting old, I do not see any improvement until I had chat with one of shanghai jiaotong university alumni - my classmate back in 2015. 

Learn and Be Curious
Leaders are never done learning and always seek to improve themselves. They are curious about new possibilities and act to explore them.


Learn and be curious


Do not learn. Do not be curious - the opposite is not good!

Leaders are never done learning and always seek to improve themselves. It may be a wishful thinking. It is hard to find time to learn and actually be able to learn. Seek to improve themselves. It is not 

easy to keep improvemnent. There is a plateau. Once you reach the plateau, it is hard for you to acquire new skills. 

Curious about new possibility - 
Act to explore them - 

How to apply sports coaching on this leaders or being leaders? 


I know that I have to stay to be coachable. It is hard for me to do that. Since I have to spend most of my time to learn the basics, work full time to make a living first. I notice that curiosity is ok but I have limited time. I have to find ways to get training on interview skills daily, get soft skills to be improved. 

I was coached in 2015 by my shanghai jiaotong university classmate from 1989 to 1992, who works for Simens in Michigan. I was told to take courses on pluralsight.com. I also try to get involve in the community as possible. I join Hackerrank community, I play contest, and post comment and also document my journal of practice. 

I learn from sports coaching. I follow all seeded tennis players. I learn from their up and downs. I start to follow them and get to know more sports traing, coaching and practice and drill, and I also attend the event, practice by myself as well. 

I like the individual sports like tennis. But it is not individual sports anymore. I like the way how the professional players handle the ....

I know that it is important to be competitive in tennis sports. I know the difference. If I walk on the tennis court, people will come to me and offer me a practice together. 

Are Right, A Lot

May 26, 2018

Introduction


It is time for me to do some study on leadership one by one. It is not easy to come out the principle, but it is also very hard for me to look up those principles without a few good references. 

The principle is called Are Right, A Lot. The explanation is "Leaders are right a lot. They have strong judgment and good instincts. They seek diverse perspectives and work to disconfirm their beliefs."


Leadership study


Are right, A lot. 

Let me brainstorm the leadership on May 25, 2018.

Leaders are right a lot. This statement makes sense or not? Leader are right a lot. A lot means bigger than 50% probability, 70% is a lot? 

Judgement and good instincts. Question is how to define judgement as strong, how to define instincts are good. 

It is hard to mainain the strong judgement. Since bible says that do not judge otherwise you will be judged. 

Good instinct? Sometimes we have to practice a lot, meet a lot of people through mock interview, and then I can quickly learn how to make good judgement. Sometimes it is easy to tell that the peer is nervous, or trying to hide lack of practice, sometime the peer tries to get hint without asking. 

diverse perspectives? Give an example about diverse perspective, 

Work to disconfirm their beliefs.

Relate to my work experience


I have to work on some way to help me get motivated and keep getting help from various resources. I need a few platforms for me to play and get recognition for the hard work, knowledge about computer science, and good working spirit and easy to collaborate.

I need to brand myself. I need to work on daily and try to put together things. 

Work with my coach

May 26, 2018

Introduction


I like to spend some time to work on my coach training, and I like to share my research with my coach this weekend. Since we like to get close, I can have more ideas to learn from his coaching.

Write a short email first


I spent time to write one email after my last mock interview. The coach does not get impressed. He replied. So I wrote another one.

Hi, Mr. xxx, 

 I like to spend give five minutes to 10 minutes to share my favorite tennis sports. I like to find out ways to win.

 Sloane Stephens, rank from 974 to 17 since she won grand slam. She had foot surgery, training again, very good story to share, encouraging, USA style success story. 


 When is our next meeting? I will find time to work on my home work before our next meeting. 

I did send another email since I sent a wrong link of youtube:

Hi, Mr. xxx, 

Sorry, I sent wrong video. I like to share one video from USA athlete Sloane. 

I like to send this video from Sloane Stephens - https://www.youtube.com/watch?v=b1QM5cjlh_w

I like Sloane's coach, and her coaches and how they work together. 

Being coachable 


I like to work on small details to make myself a good student and allow my coach guide me better to solve algorithm and data structure problems. It is second week I got a coach. 

The coach told me to work on easy algorithm on Leetcode.com.




100 minutes to work with a young graduate - Copy linked list with random pointer

May 26, 2018

Introduction


I could not believe that I spent over 100 minutes to work with a young graduate on my May 25, 2018 10:00 PM mock interview. It was such great experience, I learned how to evaluate his performance and gave him honest feedback.

First Algorithm - copy linked list with random pointer

I will come back to write down more.

Second algorithm - Maximum subarray product

I will come back to write down more.

Wednesday, May 23, 2018

Being an interviewee: Suggest a char with maximum occurrence at the position with the given prefix

May 23, 2018

Introduction


It is my most favorite algorithm to practice with my coach. The algorithm is called to suggest a char with maximum occurrence at the position with the given prefix.

The coached asked me if I have Trie experience two days before my mock interview, so I spent some time to review Leetcode 212 and also my question on stackexchange.com.

The conversation of writing a Trie data structure was very interesting.


Coach: can you explain how you define the Trie?
Julia: It should be recursive structure, Children should have Node type as well.
Coach: Do you need to have a list of numbers for children?
Julia: No. It should be minimum. Every node just takes care of its own number.

In-between the mock interview, the coach asked me why you define the Trie this way, save "ABC" as a member of class definition. I just told the coach that I memorized the solution I reviewed recently. But actually we do not need to do that here. I felt much more relax after we work together more than 10 hours.

Trie algorithm


I learn how to work with the coach and write a solution in the mock interview. And also the coach asked me to test the code using the test case documented from line 93 to line 96, I found the bug on line 107, and delay increment of index variable until line 123.

Here is the transcript of the mock interview.

Follow up 


I wrote the C# code and tested it using a simple test case. Now it is 12:21 AM, I need to rush to go to bed since at tomorrow 8:00 AM I will have a mock interview.

10:00 PM mock interview as interviewer


I also ask the interviewee to work on the algorithm at 10:00 PM mock interview. The intervewee has more than eight years experience working in Silicon Valley to target for biggest software companies, and I helped him to write a Trie solution. What I did is to try to copy my coach, how he did to me. I asked the interviewee to work on the test case, show me the trie, and also give hint to use array for fixed size instead of using Dictionary.

Here is the C# code the interviewee wrote before I write my own C# solution.

Code review from my coach


I sent an email to ask the coach to review my code before I will have next mock interview. The coach offered me to send the code before mocking interview after our second mock interview, so he can prepare better for next mock interview. We can squeeze in more activities in the mock interview together. My coach is super talent programmer and I like his working attitude.

"I think that it is definitely no problem at all. Let us meet Friday morning.

I just like to send you the code I wrote for suggest char based on prefix.

Here is the link."

May 25, 2018
8:00 AM

My coach told me that one thing is not correct. The iterate variable may be null pointer. I need to add null pointer checking on line 152.

Being an interviewee: Leetcode 42: Trapping rain water

May 23, 2018

Introduction


I asked my friend to give me a mock interview and he offered me to practice mock interview Tuesday and Thursday and Friday for 45 minutes each time. He did very good job to ask me to work on Leetcode 42: Trapping rain water. He also gave me some good advice, but he gave out the major hint too quick so that I did not have to come out the solution by myself.

I was nervous and talked about brute force solution, and then talked about descending stack. I made a mistake to try to relate to the algorithm I practiced recently. This is a bad behavior, the interviewer had discussion with me at the end of mock interview. I should get rid of this non reasoning thinking, I am supposed to work on the algorithm I have never seen before. So I have to practice my approach based on the facts, test cases, intuition etc.

The solution is nothing to do with descending stack, but the interviewer just gave away the major hint. He told me to scan two times, one is from left to right, the second one is to scan right to left.

Mock interview 


Here is the transcript of the mock interview.

Follow up


After mock interview, I wrote a C# solution. Here is the link.

Ask help from my coach in Tsinghua university


I sent an email to my coach to ask help on May 25 12:20 AM:

I am glad to find you as my coach. Here is the algorithm I mocked interview Tuesday with Mr. Yang. I did not do very well on analysis, take a look if you have a few minutes.

Here is the blog link.

I have to call it a day. Talk to you later.

May 25, 2018
8:20 AM
The coach told me that I did not have time to develop the solution using descending stack. Actually the rain water is filled up for each time range incrementally. He explained the algorithm to me based on given test case, I understand the algorithm right away.

Basically there are multiple ways to solve the algorithm, my interviewer only knows one way to solve it.

I will write C# solution based on descending stack later.

Find string s2 containg s1 permutation - 5th interview from my coach

May 23, 2018

Introduction


It is the algorithm called find string s2 containing s1 permutation. I wrote the algorithm using sliding window, and also implement the algorithm using time complexity O(N) where N is the length of string s2.


Algorithm


Here is the transcript for my mock interview. We used Google Docs.

I wrote the code but there are some issues in my code. The coach spent over 5 minutes to test my code using a test case, and then he shared with me his implementation using time complexity O(26*N) solution.

Here is my C# algorithm I wrote after the mock interview.

Tuesday, May 22, 2018

Invent and Simplify principle study

May 22, 2018

Introduction


It is the principle called Invent and simplify principle. It is my favorite. Here is the explanation. Leaders expect and require innovation and invention from their teams and always find ways to simplify. They are extremely aware, look for new ideas from everywhere, and are not limited by "not invented here". As we do new things, we accept that we may be misunderstood for long periods of time.

Principle study


Let me write down some keywords in the above principle here:


innovation and invention
find ways to simplify
aware and look for new ideas, also from everywhere. Everywhere is the keyword.
new things
may be misunderstood for long periods of time

long periods of time - how long? one week, one month, one year?


S.T.A.R story


It is my favorite principle. I have so many things to write down.

I look for ways to learn how to write simple code, readable code.

Action: I asked questions on stackexchange.com, I start to write on quora.com, Leetcode discussion panel, my own coding blog.

I practice mock interview daily, understand how others do the work as software engineer, learn to evaluate the talent, learn one soft skill a time.

I practiced one algorithm over 50 times. I have written one algorithm in mock interview over ten times.

New things I tried last 5 months:

Udemy.com
...

Result:

will seen the result one day.

Ownership principle study

May 22, 2018

Introduction


It is my task to write a short blog about Ownership principle. Here are the detail about the ownership, leaders are owners. They think long term and don't sacrifice long-term value for short-term results. They act on behalf of the entire company, beyond just their own team. They never say "that's not my job".

Here are the words in the above statement:
Leaders, owners,
long-term value  vs short-term result
entire company   vs their own team
That is not my job

Study note


I like to study the leadership one a time.

If I like to apply the principle to my current job, what is the case?

Long-term value vs short-term result

Long-term value - I try to rewrite the website to make sure the code is readable, remove smell of code, write simple code, break giant function or object into small objects. Apply object-oriented design.

I plan to study those courses on frontendmasters.com about web security, and I learn how to use Google web browser developer tools.

Short-term result - visual things to do, visual evidence I do the work. Something surface level.

This is not my job - Have I said that sentence before?


S.T.A.R story


I like to come out a few stories related to ownership.

Source control


S  - Situation - Virus issue on my computer, ransom attack
T - Task - I need to figure out better way to do source control
A - Action - last August I started to purchase github service annual subscription. I did some research on source control available products, and then I chose to subscribe the github.
R - Result  - The source control is advanced to much better status compared to before.

Web server and database migration

Anti virus software incident 


S - Situation - false positive, the anti-virus software deleted database file
T - Solve the issue - restore the database
A - Restore the website
      Study the virus and anti-virus, and ask questions about false positive issue
      Need more work here ...
R - Result
   

Website onwership


I need to balance my time on different issues, front end, use interaction, website architecture, SQL server administration, and all related issues.

A list of things happened:

SQL injection attack

Virus software removed the database file

Database server and web server migration

Work with consultation company to upgrade the database server, IIS server

IIS 8.0 learning

C#, JavaScript, HTML, CSS, Jquery coding

Vacation break challenge

Work with sales, marketing and graphic design

Move source control to github after ransom attack, server upgrade etc. in 2017.

Business analysis ownership


Sales analysis or any analysis, how to handle dispute? The program I write and design I have to make change after 2015, if there is any dispute, I should be able to set down the dispute in less than 5 minutes.



Monday, May 21, 2018

From Julia coding blog to self-training course on udemy.com

May 21, 2018

Introduction


It is the holiday and then I tried to do something creative. I like to prepare for a course on udemy.com, the course is titled "From Julia coding blog to self-training course".

I have a list thing to do before I can submit the course for a review.

Things to work on


Here is the things to work on. I am planning to find time to work on 30 minutes a time.




Good programmer needs friends

May 21, 2018

Introduction


I could not believe that I got contacted by a few friends I made over mock interview practice last 12 months this long weekend. The work they did for me are touching my heart.

I am more open and confident. I first purchased my video course on udemy.com and also I purchased grokking system design interview course.

I still remembered that one of UCLA students gave me mock interview comment, stubborn, do not take hint less than six months ago. I worked on the algorithm called Largest smaller key in BST. 


Most challenge work 


Today I also like to write down for a small research topic called most challenge work I have done. If it is not challenge enough, I will find another one. I will try a few times until it is really challenge one. 

I had a holiday break today, and then I invited my friend to chat with me. I was trying to relax and have some reading work to do before I work on my home work from my coach. I did not do very well on my last mock interview, I practiced over ten times on word count engine algorithm. The coach gave me similar question, but he likes me to show very good coding as well with optimal space complexity. 

I do believe there are a lot of benefit to join one community or another one in order to help to build a good career in software industry. But I do think there is something missing in normal business practice. I also try to experience and tell that. Do your current job very well. Make your current employer happy. 

Counter argument is that if you can get a job with double salary why you choose to work on the less one. But in reality, only less than six percent will be selected after phone screen and onsite screening. Most of us are still working on daily job as usual. 

Another thing is how to embrace the hard work. I do see my weakness to solve simple and medium algorithm, since I like to solve advanced ones or hard level on Hackerrank, I notice that it is easy to get excited and continuously try to solve one, 10 hours to solve one algorithm scoring one with score zero. No complaint and also I was so happy to have pushed myself so hard on submitting all kinds of ideas against online judge of Hackerrank. 

I have worked with my coach last past week, I understood that he must have put hundreds of hours to complete Leetcode over 600 algorithms. I could not do it for all kinds of reason. I also like to get reality what weakness I have once a while. 


Try to answer this way



My most challenge work I like to do is to make my current job very easy and relax. 

It is not easy for several reasons right now. I have to learn so many things but I like to get good at foundations which are computer science data structure and algorithm.



Find best coach 


I practice so many mock interviews and meet a lot of people. One day I was so amazed that the peer performed so well since I could not fail him after I gave more than four algorithms. After more than 90 minutes talk, I knew that I may find a coach for myself.  


After more than four months, I contacted the graduate student and ask his help to be a coach and hitting partner to practice algorithm and data structure. The coach has practice over 600 Leetcode algorithms. 


Work with the coach


It is not easy to work with the coach and come out the good result in three weeks short time. We have to work together enough time before we can trust the coach and player relationship will work very well.


Why it is most challenge work? 


First I have to understand why I need a coach. I learn it from tennis sports last few years. 

By observing how professional tennis players prepare for China open in Beijing, I learn how professional tennis players develop relationship with each other and also with coaches and hitting partner, personal assistants. 

I need a coach this time for three weeks preparation. Why I need a coach? I try to get more educated and well-prepared. I like to beat the odds against 80% with more dedicated training. 

My coach can help me think about more in terms of algorithm and data structure. And I like to find out my weakness and learn something from the coach's experience. 


My fourth mock interview given by coach - suggest a char

May 21, 2018

Introduction


It is the fourth mock interview I got from my coach. He demonstrated his superior coding skills, he reviewed the code I wrote after mock interview, I made a terrible bug in iterative solution of find the height of tree algorithm documented in the blog, and then I should continue to simplify recursive solution for height of tree as well. It took around 40 minutes for him to review those two algorithm, and one more from the peer I interviewed as an interviewer.

Algorithm to suggest a char


Here is the transcript I worked on the algorithm and my coach spent time to coach me using less space, instead of going over each word, he advised me to go over each char at the same position in all the words.

I also showed him my word count practice, and asked his code review.

We worked together very hard, I am in the city of Vancouver, and the coach is in Beijing, China. I wad told that the talk is cheap, show me the code. I never doubt my coding ability, I think if I explain the idea, he should trust I can write. But that is not the case yet.

The time of interview is from May 19 8:00 AM - 9:46 AM PST.

The code is here to lookup.

Being an interviewee: Set binary tree next pointer

May 21, 2018

Introduction


It is the first meeting I had with the friend's friend. I like to meet and practice algorithms together. My task is to write a next pointer for a binary tree.

Mock interview


Here is the algorithm I wrote.

Leetcode 116: Set binary tree next pointer

Being an interviewer: Copy linked list with a random pointer

May 21, 2018

Introduction


I was surprised to get contacted by a friend's friend and it is from another country Australia. I was so surprised to learn that. I have a new hitting partner to practice algorithm and data structure.

I spent first 20 minutes to share my experience of learning first. Here is the gist I documented, the note is kind of messy, next time I will write more clean and make it more readable.

Mock interview algorithm


I gave an algorithm for the peer to work on. Here is code and then my code for copying the singly linked list with next pointer.

The peer spent over 10 minutes to write a function using iterative solution, and then I also gave my code with some explanation.

Random pointer handling


The peer also worked on the random pointer, I had to ask her to give me her idea first before she wrote the code. And then she found out that she had some issues to figure out how to do the work.

Here is the transcript.

Sunday, May 20, 2018

Prepare leadership stories - moving to No. 1

May 20, 2018


Introduction


It is my long weekend. I really enjoy so many activities. One thing I did is to find leadership stories by going over my resume and then reading some blogs. 


What I also like to do is to document some sports time. I like to watch those tennis professional players. I like to learn how Angel Kerber handled her advance to No. 1 ranking in 2016. 



Interview study


Here is the blog I reviewed. 


Angelique Kerber R3 Interview in Studio - Sep 2, 2016, the interview link is here


I like to borrow some ideas from the above interview, and I like to use those ideas to help me find stories in my past 8 years and them categorize them with leadership principles. 


It is so special to learn from sports

Do not get into second week of grand slams. Talk to the coach and set a goal. 

Set a goal to play big tournament very well. Get into second week of tournament. 
Going for it? How much more aggressive? 
  
Technique - hit early, going for, focus on every single point 
  57%, 10%, 33% 
selection of shots - work on the practice -> going for right shots

Try to go for, 
improved attitude? 

  Go out .., put heart on the court, moving better, ..., enjoy everything, ..., if not so nervous

No. 1 ranking? 
  Day will happen. It is still focusing every single point out there. 


Friday, May 18, 2018

Leadership principles - Customer obsession

May 18, 2018

Introduction


I have to learn leadership principle one by one. In order to learn better this time, I like to write a blog for each principle.

I am very good to write short one first and then add some good content later on.

Customer obsession


How to relate to my own work last 8 years? Do I really understand the customer obsession leadership principle?

keywords:
Leaders start with customers and work backwards. <- backward, start with customers

Work vigorously -> vigorously -> how to express vigorously?
Earn and keep customer trust -> trust, earn and keep
How do I understand the trust, customer trust?
Alternative choice, competitors, pay attention to vs obsess

Two groups, one is competitors, one is customer.

My task 

I need to write my own story. It is not easy to write a good one without preparation. I will think about and write down something here.

I need to identify the customer and competitors. How to define pay attention to and obsess? Give an example of Earn and keep customer trust.

Brainstorm stories:

1. Current employer is my customer, next employer is competitor; I need to pay attention to the competitors, but I Need to be obsessed with customer. Earn and keep the trust.
Evaluate current company website, need to make code readable, clean. I like to make the software product as simple as possible.

Do not pay attention to the competitor.
First five years - work with different technologies - play and try
Last three years - work on foundation of data structure and algorithm. Try to write coding blog, ask questions on code review stackexchange, write on Quora.com. Meet people through mock interview platform.

2. Cellular phone, high density device, mobile website image display. Extra work for graphic work.
3. Website fit for all devices vs website maintenance issue, subscribe the courses to help myself strength the website; fancy interface, sales manager pitch vs customer need. Keep busy or look busy vs work on basics
4. Vacation plan - one week - Learn to plan, listen to the opinion. Catch up latest technology.
5. Virus software false positive - remove virus software from database server
6. Network virus - ransom attack - version control - github - website source control
7. Web server database server/ IIS server migration
8. Read my common mistakes after 80 mock interviews, there are some good story to think about.
9. Another one:
http://juliachencoding.blogspot.ca/search?q=stackoverflow+
10. Story about website does not response very well. For example, product menu bar is designed to list 7 products in a row, the customer has difficult to choose one to continue. One thing I came out is to add hover over display, listing all lumens of the product.

I did a few hours work to show the prototype of the work. (Situation, Task, Action, Result)
11. Hold high standard. If there is any dispute, the software I design and develop, I should be able defend my number in less than 5 minutes to settle down any dispute.

Grokking the System Design Interview

May 18, 2018

Introduction


I have to start to learn system design today. I really like to learn something this time. Recently my friend spent 90 minutes to talk about system design to me. I am really excited to learn something new this time.

Two years ago, I had chance to learn something to prepare a system design interview. But I did not learn very well.

I like to purchase the course and then spend time to read those materials. I want to learn system design very well, so I can use the skill to work on exciting projects.


Study time


I have to simplify my system design learning. I like to spend next two weeks to work on the system design, focus on Grokking the system design interview first.

One thing I like to do is to log the time I spent on the reading.

May 21, 2018

One hour reading ...

May 26, 2018

I spent a few hours to read system design for pastebin and instagram,



Software engineer interview unleashed

May 18, 2018

Introduction


I decide to purchase the course on udemy.com given by former Google, Ph.D. Jeff Bae. The course is called software engineer interview unleashed.

I like to show the support for the PH.D., and I like his hard work to present a course on udemy.com. I wish that I can put together something with my coach together next two weeks. But I know that it is not easy to make a good one.

So excited, my first Udemy course


I like to spend time on the course as soon as possible.


Leetcode algorithms tagged by stack

May 18, 2018

Introduction


I like to find all Leetcode algorithms tagged by stack, and then I can read those algorithm problem statement first.  I am training myself to analyze the algorithm, quickly relate to stack to figure out how to solve the problem.

I notice that the training of data structure and algorithm takes a lot of work. I had three mock interview with my coach last Sunday, Tuesday and Thursday. I learned that it is good to have a coach, who can help you prepare for better performance in short future. I was tested on algorithm called Next great element.





Thursday, May 17, 2018

Being an interviewer: Find least number of perfect square sum to given number

Being an interviewer: Print binary tree extreme corner alternate order

Leetcode 152: Maximum Product subarray

May 17, 2018

Introduction 


I just could not believe that I have chance to interview top university graduate student with excellent performance. I chose two algorithms I had this week mock interview given by my coach, the interviewee solved two of them quickly and very efficiently.

I just asked her third algorithm after 50 minutes to see if I can fail her on the dynamic programming algorithm. We had good discussion on this algorithm called Leetcode 152: Maximum product subarray.

Mock interview 


I will write down some discussion here. I like to learn the algorithm at least 10 times with various talents in the world first,  and then I will definitely feel more comfortable to solve the dynamic programming solution.


Find next large value in the array - my third mock interview given by my coach

May 17, 2018

Introduction


I have the third mock interview given by my coach. I was surprised that the coach encouraged me think hard in mock interview. I like to write down our discussion and help myself to learn this algorithm using stack to track next large value.

Mock interview


Here is the transcript. I will write down my analysis, discussion with the coach, how the coach gave me hint. What are things to work on?

I am exciting to learn the algorithm through practicing with strongest hitting partner in the world.

After mock interview ...


How to train myself to come out the optimal solution?


In my mock interview, I did a few things correctly. I started from brute force solution with time complexity O(n2), n is size of the array. And I told the interviewer that I like to do preprocessing.

How to do it? I think that there are two popular ways, one is to use dynamic programming technique, to save the maximum or minimum or other statistics from left to right or right to left iteration.

And the other is to bring stack descending or ascending order to help, this one has some advantage to handle magic things.

Actually the second one is to bring stack descending or ascending order to help, this one has some advantage to handle magic things. My coach taught me the two words summarized as ascending stack or descending stack. I just could not believe that I could not figure out the technique since I do not play with more test cases.

The coach told me that I should say that let me think about a few minutes. So this way I do not need to talk all the time. Quiet time is also very helpful.

My favorite algorithm


I do not know how to push myself to think smart in the mock interview. I have practiced largest rectangle histogram using stack a few times last 6 months. But under the stress of the interview, the data structure just cannot come out quickly since I thought about each element in the array to store data using a data structure, like an array. But I break somewhere in thinking process to connect dots, so I like to write some dots like the following:

I believe that playing with simple test cases I can come out the idea naturally.

But in the mock interview, I was thinking that it takes too much effort for the coach to set up meeting, sacrifice of time to sleep, it is past 12 PM midnight in China. I could not concentrate to push myself think harder.

I just wrote down more here now since it is after the mock interview.

First I talked to my coach to simplify the test case. The coach said that let us get half numbers. I told him that let me choose simple number on line 33: 1, 2, 3, 2, 1

But I like to think about more, to work on a few base cases:

1. test case: [1, 2, 3]

2. test case: [3, 2, 1]

3. test case: [2, 1, 3]

How can I do preprocessing?

First let us go over the answer for each test case.

For test case 1, [1, 2,3], the answer is [2, 3, 3]. The largest one is its right neighbor, the array itself is ascending order.
For test case 2: [3, 2, 1], the answer is [3, 2, 1]. Notice that the array is descending order.
For test case 3: [2, 1, 3], the answer is [3,3,3]. Notice that first 2 elements in the array are descending order, and then 3 is bigger than previous.

And also I am thinking this way. Preprocessing using dynamic programming idea.

First test case:

[1, 2, 3]

The coach gave me hint to iterate from left to right, I like to follow him instead of right to left.

Iterate the first number 1, what I should put into preprocessing array, I could not tell, I need to find largest number met in the future iteration. I do not want to go back again, I need to save it.
[1, ?, ?].

Iterate the second element with value 2, we need to give 2 to its previous element with index = 0, we need to move index = 0 out of data structure, and put result array [2, ?, ?].


Second test case:

Let me work on the second test case:


[3, 2, 1]

First iteration, visit 3, we have to save index = 0 into a data structure, since the coach told me that I should save it to a data structure.
Second iteration, visit 2, 2 is smaller than previous one, save index = 1.

Test case 3:

[2, 1, 3]

Let me talk about magic thing about [2, 1, 3] test case.

First iteration, visit 2, we can not do anything, push 2 to the data structure. Next iteration visit 1, since 1 is smaller than previous value 2, I can not do anything either. Push 2 to the data structure. Now iteration visit is 3, which is bigger value than previous number, we have to put index = 1 with value 3, and pop index = 1 out of data structure; now index = 0 is the last one, 3 should also go to index = 0.

So the order of assigning the value is in reverse order. The index is at the top of data structure, and then it can associate with current iterated visting element.

There is a first in last out process.

Just try to please my stack muscle memory! I am counting on this piece of memory. I should practice more on this thinking process, related to one simple test case.

I was busy thinking that each element holds one data structure when the coach gave me the hint.

I love to learn this algorithm, so I just write down more and see if I can use the approach by playing with test cases.


Ready to show my coach the solution


I wrote a C# solution and then I can show my coach the solution this Saturday May 19, 2018 8:00 AM mock interview. I like to find out if there is extra line of code included, or the code can be improved. It is always excited to have a coach. I need to get back to stay confident and positive.

Usually my coach will say that you clean up the code very well. But in mock interview, you write messy code with a few bugs. It will be written down and take points away.


Research algorithm based on stack



I am planning to work on algorithm based on stack. Here are the list of algorithms related to stack.