## Sunday, April 30, 2017

April 30, 2017

### Introduction

It is a very happy weekend with a world codesprint contest and then two mocking experience. Julia also spent one hour to play some tennis and felt much better after she ran 30 - 45 minutes, she was amazed that her muscle memory of tennis was so good, she could control tennis balls so well through a full court rally. She enjoyed the sliced shot and very good timing and control of landing position to hit a stroke.

She also felt that it is important to seek the advice to be a just-so-so contest player scoring 36 points over 13 hours compared to top players scoring more than 280 in less than 2 hours. Read those data - less than one hours 10 minutes, top number 1 - Gennady.

What are the missing parts she should work on next?

A lot of professional WTA tennis players are very good at changing coaches when they deal with up-and-downs. What does Julia do for this case? Should she change her coach? She is self-coaching and writing blogs to keep tracking of her progress.

Need a therapy after the contest. Remember the favorite video she watched about Roger Federal talking about his early age, throwing tennis racquet in front of thousands fans. Take some time to learn from Roger Federer.

Watch this video to get entertained. Roger Federer - top 10 smiling after points lost, link is here.

### Talent talk

Where is the talent? I like to find some drills to work on to help myself to cover the weakness of talent.

Watch the video - tennis funniest moments ever. Link is here. And read the article - waste time is healthy in big data term, link is here

### Data structure talk

Julia met a same person for the second time in less than 30 days through mocking experience, and then she learned a few things through 30 minutes. Friendship forms quickly after the first experience.

Case 1: She likes to design a data structure to return a list of pair integer numbers in the array, she said that since it is the unknown size, she likes to declare C# IList<string>, and then "why it is string?" The peer asked, Julia said that because there are two numbers, I like to encode and decode like a + b; otherwise I like to use Tuple<int, int>, the peer just typed that you just use this one IList<int[]>.

Julia never uses this one before, but it is so good ride once she uses it. Story is short, better give a good name "int[] beats string".

Case 2: Julia likes to change HashSet to a Dictionary<int, Object>, and then the peer asked, can you make a minor change to fit the requirement; Julia was told to finish the coding, and do a whiteboard testing using a test case. Do mocking algorithm really need Dictionary that complicated?

Through the discussion, Julia learned that it is a good practice to write simple code. Be more organized!

Transcript is here. Later it will be compiled to C# code.

### Recurrence formula talk

It comes out that the recurrence formula is challenging for those 3  talented programmers in the world last weekend. In other words, Julia used the same algorithm to interview two people last weekend.

Her first interviewee was troubled, confused, since the problem statement is wrong, and Julia had difficult time to step in and give good hints to guide, since Julia had a math degree but it is like the muscle to fat story, she also got confused on recurrence formula in those 30 minutes. But then second time to use the algorithm, Julia was more determined to apply recurrence formula, no more playing with test cases. Just write down clearly the formula first.

The interviewee is much quickly to take hint, and then write code. She felt those two difference. Less experienced one is much more easy to try new things.

Also Julia learned the algorithm quickly, when she interviewed second person using same algorithm, she wants to make the difference. She learned that good interviewer should do something to help out.

### Whiteboard technique

From the contest to the leaderboard by Microsoft to a blog writer -

Google intern and interview blog is here. Whiteboard talk is excellent.

### Bronze medal talk

It is the time to celebrate Julia’s fifth bronze medal, Julia got a bronze medal for world codesprint 10. How to express the feeling of bronze medal? Julia likes the hard work she put in those hours, and she did so much work and tried again and again for new ideas to break through the hurdles. She is more experienced to play contests now compared to last year.

Julia takes time to enjoy her status right now, one day she will easily make over 30% or over 100 points and come back to look at the stage she is in. Honestly the contest is like school home work, and bronze medal is for Julia to celebrate a grade “C”, but she tries to get grade B – silver medal, one day she can get grade A. Julia scored 36 point (360 maximum points), 10% scoring.

Julia likes the competition because it is fair, open and her peers are all over the world. Compared to take algorithm course in university to learn more, she does not need to figure out who is the professor in the university, fair or not fair on grading. All she has to do in the competition is to work damn hard, write down something, either a blog, or code or analysis. Dedicate a few hours on each algorithm in the contest. From there she can continue to work on after the contest.

Psalm 126:5 Those who sow with tears will reap with songs of joy.
6 Those who go out weeping, carrying seed to sow, will return with songs of joy, carrying sheaves with them.

Julia sowed, teared, reaped, sung, weeped, carried.

### Follow up on data structure talk

In previous data structure talk, Julia shared the story about mocking experience. The peer coached her to use int[] instead of using string or Tuple<int, int>. Such a wonderful coaching through mocking experience.

Afterwards, Julia asked her favorite algorithm coach JS1 on code review about using int[] data type compared to string related to Queue. Here is the algorithm question on code review.

do you think that it is also good idea to declare var queue = new queue<int[]>? row and col can put into the array new int[2]. Therefore, we do not need to encode a key and then decode the key to row and col two variables. I am learning data structure and try to speed up coding. – Jianmin Chen

It's a matter of preference. I tend to use primitive types whenever possible, but if using `int[]` seems easier to understand than using a single `int`, then you should do that. Note that using a single encoded `int` leads to a simpler `visited` array as well. – JS1

April 30, 2017

### Introduction

It is a good decision to review the contest practice, from several perspectives, hours spent, breaks taken, and things to work on in order to improve performance.

### Contest Review

First of all, do not sit in the home office more than 13 hours, no breaks. It is not healthy, and do not worship the contest result. It is just a tool to help training the great thinking in algorithm problem solving.

Also, it is a very good intense practice to write a few algorithms in a day in the contest. The whole week was gone without writing some algorithms until this world codesprint contest.

## Saturday, April 29, 2017

April 29, 2017

### Introduction

It is a good idea to do some research about the algorithm, how difficult it is. Julia just did a quick research and then found out this algorithm - Node-point mappings is not an easy one. Players like ICPC winners may not score full points, only partial of them.

Through the study and research about the algorithm, Julia noticed that it takes a lot of efforts to master the algorithm in advanced level.

Here is the comparison with one of top players. Julia noticed that it takes a lot of work probably years, thousands hours to be able to perform like the other one.

And Julia reviewed the player past performance:

• 1st at USC Programming Contest
•
• Gold Medal at the 2014 ACM-ICPC Asia Regional Contest, Shanghai
•
• Gold Medal (the 4th place) at the 2014 ACM-ICPC Asia Regional Contest, Beijing
•
• 19th place at the 2014 ACM-ICPC World Finals, Ekaterinburg
•
• Gold Medal (the 4th place) at the 2013 ACM-ICPC Asia Regional Contest, Changsha
Profile is here.

It is not easy to learn by yourself and catch up the performance. Best bet is to go back to the third and fourth algorithm and try to score any point in the fourth algorithm.

### Code study

Problem statement is here.

4/30/2017 1:17pm
.

April 29, 2017

### Introduction

It is a wise decision to spend time for each algorithm in the contest. Even Julia did not make any points last few hours, she found out that it is better to write a brute force solution even scoring 0, or write a blog about the algorithm.

The maximum disjoint subtree product algorithm should be a DFS/ BFS tree problem. Julia had some idea to solve the problem, but she was not sure how simple the code should be.

The problem statement is here. Just work on the most simple test case, and then write some code first.

Plan to do 60 minutes workout on the algorithm. 3:03pm - 4:03pm.

### Code preparation

Read one of players resume, and go over all the players in united states scoring 60 on the algorithm. 3:13 pm, study those players and get myself ready to think about a solution and start to write down some code.

4:00pm now - spent 20 minutes to go over those 24 people scoring 60 maximum points, and I knew that those are very experienced ones, Julia spent time to loo at those who scored 3 points, 6 points, to 30 points. Those are players who are working hard as well.

Go back to study on topcoder webpage after googling disjoint set, make the algorithm general. How to approach? Article is here

Finished 15 minutes to read the disjoint set article first. Time is checked, 4:15pm.

### Disjoint-set Data structure - topcoder tutorial

Disjoint sets, dynamic disjoint sets,
Define two sets are disjoint - intersection is null
representative - Every disjoint set contains a representative

It is assumed that the representative of each group is the person with the biggest index in the article.
Every one has its own group
-> the group containing 1 and the group with 2 will become one group.
-> the representative of first group will become 2.

How to check if two persons are in the same group? Check the representative.

Define some operations:
Create-Set
Merge-Set
Find-set

Each element will be in a linked list and will contain to the next element in the set and another point to the representative of the set.

Read the graph representing the problem, catch up more later.

Read how to implement the Merge-Set(x,y) operations.

a weighted-union heuristic - complexity O(M + NlogN)
where M is the number of operations (Find-sets, Merge-sets, Create-sets), N is the number of operations Create-Sets.

Two heuristics -

Union by rank
Path compression

Time is checked again, 4:53pm.

Move on to next topic

### Being a hacker

Wrote a brute force solution to work out on sample test case, but the code passed test case 1, failed 2, 3, and time out everywhere. Score 0. Time checked, 10:53pm.

Can hackerrank give me 0.001 points? I just need 0.0001 points.

Is that possible to give 0.25 points for passing test case 1? I wrote a brute force solution just to try to advance my ranking. My points are 36 points, ranking from 767 - 1307 all scoring 36 points. Never work so hard to advance 0.25 point, failed this time.

Code written in the contest is here

Study one of C# submission code. C# study code is here with sample test case.
Continue to code review the algorithm, prepare to give a code review on stackexchange.com, here is the C# code.

April 29, 2017

### Introduction

Problem statement is here.

The algorithm is very interesting. Julia has to find one of algorithms to work on and make some points. Start from one extra point first, now is 4/29/2017 12:50pm.

Julia wrote a brute force solution and sample test case of  "7 people are happy out of 10" is timeout. At least Julia started to write the code and understand the problem now. It is 2:04 pm, almost 60 minutes later.

One of ideas to solve timeout is to use dynamic programming. Need to figure out the recurrence formula next step.

In general, we only need to make sure that at most n - k are not happy, but we do not too much detail.

### Coding in the contest

After the contest, Julia published her code using recursive solution. Link is here. Score is 0, timeout all the test cases. But it is a great workout for recursive solution.

Julia did think about the dynamic programming in the contest, she tried to build recurrence formula. She almost had the same idea showed in the editorial notes. But she did not write down the detail.

It is a good idea to write down the dynamic programming thinking process, and post the algorithm on the code review later on. It is not hard, for a mathematics major, all Julia has to do is to start to practice again the mathematics analysis. She will figure out what to do next after the contest, how to train herself better.

April 29, 2017

### Introduction

Problem statement is here.

It is the medium level algorithm, but Julia worked over 7 hours and she only managed to score 6 points out of 30 points. She tried a few time, scored from 3 point to 6 points. She was so hardworking and put together the test cases, and also make sure that her code is readable, function name and variable name are meaningful. She is waiting for inspiration to break through, still waiting...

Julia spent time to write a binary search algorithm, and she enjoyed the function to help her gain 6 points. What else she can do? World codesprint #10 is so tough, she now knows that people are so talent in the world. More than 5 players finished all seven algorithm in less than 2 hours, and the first 3 winners are finalized with \$2000, \$1500, \$750 prize money.

It is very exciting contest and also it is most competitive contest compared to week code or others.

Show some progress and cheer up.

Here is the comparison Julia chose to compare with a Google employee.

### Coding in contest

Two test cases time out and also near 10 test cases wrong answers. Need to read the discussion board.

4/30/2017 9:36pm

After the contest, Julia published her code in the contest, link is here.

Need to download test case 6 and figure out why the code fails test case 6. In theory, the algorithm is exactly the same showing in editorial notes.

5/1 2017
Code after the contest - replace recursive binary search with an iterative one, pass test case 22, 23, score from 6 up to 7.14.

Code is here

5/3/2017
Read code submission the_watcher and lewin, learn to write using bit manipulation.

## Thursday, April 27, 2017

### Count of Smaller Numbers After Self

April 27, 2017

Plan to study the segment tree algorithm - count of smaller numbers after all.

### segment tree

April 27, 2017

Plan to spend 30 minutes a time to learn segment tree from the Chinese blog.

April 27, 2017

### Introduction

It is Julia's favorite algorithm - segment tree. Past practice related are here. The first one is the algorithm Kindergarten adventure Julia asked the algorithm on code review website. The another one is the Chinese blog related to segment tree.

### Code study

Problem statement Box Operations is here.

Expert difficulty, time complexity O(n*logn*logC), required knowledge: segment tree.

Plan to work on the algorithm 30 minutes a time. Document the progress.

April 27, 2017

### Introduction

It is always good to train very hard on expert level algorithm, and then it is much easy to work on algorithms in daily work or being on trial to pass the important test.

This algorithm is called the optimal polygon, the problem statement is here.

### Code study

Plan to spend 30 minutes first to read the problem statement and also think about the solution. Log every 30 minutes spent on this algorithm, and document the progress to learn and breakthrough the hurdles one by one.

Will come back to work on first 30 minutes very soon.

April 27, 2017

### Introduction

It is a wise decision to learn one expert level algorithm using dynamic programming and also RMQ algorithm.

The problem statement "Two Subarrays" is here. Maximum score is 70.

### Code study

Plan to spend 30 minutes to study the algorithm.

### Toll Cost Digits - World CodeSprint 9

April 27, 2017

Introduction

Problem statement is here.

Hard problem, time complexity O(N+E), required knowledge: graph, BFS/ DFS.

Plan to work on the algorithm 30 minutes a time.

April 27, 2017

### Introduction

The world codesprint is different from weekly code challenge on Hackerrank. The algorithms are more challenging and general, each world codesprint is also supported by some companies. Every 3 months there is one world codesprint on hackerrank. It is very wise idea to look into those algorithms and learn some new algorithms.

The problem statement kingdom division is here.

### Code study

Ideas to learn the algorithm after the contest can be anything like reading some submissions, general study of the topic.

Plan to spend 30 minutes to work on the algorithm. Will come back very soon.

## Tuesday, April 25, 2017

April 25, 2017

### Introduction

Coding blog is part of my daily routine and then Julia also tries to learn something daily. Today I chose to study Sharapova through her tennis interview. Here are the interviews I went through and I liked the candid talk about sports, competition, design talk and business training etc.

Right now, Sharapova will come back to tennis sport this April using wildcard of tournament because she lost her ranking last 15 months. It is tough for her to come back like that, I also learns from Sharapova. It is amazing that Sharapova can express herself so well using English, amazed that she does not have time to go to college, but her intelligence and logic thinking is so well.

Maria Sharapova on training and preparing for WTA Tour comeback - link is here.
Sharapova's return - link is here.
Larray King - Maria Sharpova on locker room friendship - link is here.
Larry King - Serena is An Incredible Athelet - link is here.
2012 Alex Zolbert - Maria Sharapova's CNN talk Asia interview Part I - link is here. 7 minutes 38 seconds

2013 - Brisbane international 2013 - link is here.

Note:
I - Julia, the blogger write usually like to write using she instead of I.
She - sharapova

### Coding blog small talk

Big thanks to Google to provide Blogger such wonderful product, Julia enjoys the work daily to write down everything, and then she can rely on the Blogger, help her to share what her work and also provide a plaform for her to push herself to work hard and concentrate more on the coding.

Julia was so surprised but she found a fact that top tier companies young programmers most of them can really perform high level coding skills, in terms of Hackerrank algorithm level, hacerrank.com, yelp.com, Alibaba.com, Google, Microsoft, all those player score high than Julia. Julia only performs top performer 30% and it takes her more time to reach the 30%, estimated 50% more time.

It took a four years until 2015 Julia decided to open herself and then shifted her focus on a most simple thing - coding, write down algorithm, show the naive, baby step to the world. She looked back the blogs she wrote in early 2015 and code she wrote early in 2015, the tough algorithm she felt and troubled over a week in 2015, now it was so natural for her to come cross the similar algorithm very often through her routine contest, weekly practice, mocking practices etc.

Another fact is that a lot of people work so hard to advance their coding skills, algorithm problem solving, but julia also likes to work on her writing skills in the same time.

Julia also found out that she learned better from tennis tournament - WTA, ATP events, professional tennis players. She spent over five hundred of hours to play tennis from 2012 to 2015, she got the experience how she gained the skills through hundreds of double matches, single matches, she played those 3 years tennis more than over 14 years in total in Florida, hundred time more, she played with over hundreds of hitting partners. She first experienced that tennis sports is her personal sports, she enjoys the sports and understands the hard work.

All she likes to do is to transfer last 3 years intense practise experience of tennis to coding. Coding can be tremendously improved by going through contest, competitive programming, all she has to do is to practice more, using Blogger to help her to manage the journey, get the data and analyse them.

## Monday, April 24, 2017

April 24, 2017

### Introduction

After over 10 times mocking practice in April 2017, Julia finally felt much better to understand the algorithm problem solving and what she should do in her best interest. She understood that her mocking experience is related to the performance on her contest experience on Hackerrank. Right now she is still struggling to solve medium, hard and advanced algorithms on Hackerrank, performance of hard algorithm is from 15% to 30% of those algorithm.

To set a goal to get her first golden medal on Hackerrank contest, Julia likes to make a plan what she can do to help herself.

One idea is to review Hackerrank algorithm leaderboard. Julia did find something to study and then she read that people solve over 3000 algorithm problems and then usually can get good performance.

Bohdan hackerrank profile is here.

Plan to spend one hour a time to read quora - Bohdan Pryshchenko.

Is competitive programming helpful? Quora question is here.

Julia thought about this question. She made new friends through hackerrank contests, and also she got a few people to ask to connect through linkedin since they read my blog this month. And also Julia had good time to get help from stackexchange.com code review for those hackerrank algorithms. Most of important is that Julia started to review code she wrote before, and then she quickly comes out new ideas to improve.

### Training style - discipline monitoring

SFU computer science Ph.D., Matafa Saad - article is here.

## Sunday, April 23, 2017

April 23, 2017

### Introduction

Timeout is the big challenge for the algorithm - visiting Manhattan.

### Code review

C# submission is here. Score 7 from 40 points.

April 23, 2017

### Introduction

A minimum heap C# code is needed for the Email everywhere algorithm in a booking woman in tech contest, so Julia googled and found the C# code. She put together with the algorithm and then she scored 30 points with a full score. Learning to use heap is a great mark for Julia, she knows that completely sorting is expensive, if only max and min value is needed, better to use binary tree, not binary search tree. Julia starts to learn using heap when she work on algorithm problem solving.

### Code review

C# code is here. Need to add some test case and do some code review.

April 23, 2017

### Introduction

It is most rewarding experience to learn and score full 30 points on this algorithm called Email Everywhere. Julia did not have time to practice C# code to write a min heap or max heap using array. She tried so many things but this time she borrowed the code from the internet, and then make it work for the algorithm.

It is a good experience to write brute force solution, and then continued to improve and solve the problems. Look at the submission of the algorithm, Julia learned the min heap and algorithm design through the contest. Well done. Here is the report of submission:

From 2.5 to 4.17, and then 19.17 and then 30 full points, Julia tried to review each step and then write down how she works better next time.

### Code review

The last submission with full score 30 is here.

Back to first try, wrong answer and timeout, pass 4 test cases, scored 2.5. Code is here.

Second try, scored 4.17, no more wrong answer. Code is here.

Third submission, scored 19, code is here.

April 23, 2017

### Code review

The submission of C# code is here. Score 10.77, maximum score is 60.

April 23, 2017

### Introduction

It is most favorite algorithm in the contest. The algorithm is to find the optimal solution using DFS/ BFS, and also need to work on memorization to remove duplicate work, take care of timeout issue.

The problem statement is here.

Julia spent so many hours to work on DFS - recursive function, or using  a stack to do the work. Search the blog using DFS and then a lot of work will be listed here. But Julia worked on in the contest more than 6 hours from 2 pm to 8pm, and she still could not figure out 5 wrong answer test cases.

Algorithm problem solving is such a fun activities. Through those long hours problem solving, Julia now knew so many things she had to learn and work on. This booking contest just let her know that how challenge the work will be if she lands  a job to deal with millions customer.

### Code review

The last submission in the contest scored 30 out of maximum score 50. The code is here.

5 runtime error, not timeout.

The submission scored 25 out of maximum score 50, timeout 5 test cases at least. The code is here.

The submission score 23.75, timeout and runtime error. The code is here.

This is the great workout for Julia to learn the algorithm. She replaced recursive solution with a stack, and then she worked on the idea to avoid duplicated calculation. Every node is visited and then sum and maximum value will be recorded, only better candidate can allow to visit again.

From the score 23.75 to 30, Julia worked on the problem solving, understood how important to keep the code as simple as possible. She worked on her last submission to clean up code more than 30 minutes. She learned to discipline herself to show clean and readable code.

### Actionable Item

4/26/2017 9:32pm

Work on the test case 9, and then figure out why it is a wrong answer for my submission. Look into the issue. Figure out the solution to pass all test cases first.

Post a code review once I can write a solution to pass all the test cases. Right now, there are 78 players scoring full score 50 in the contest.

Similar question "KnightL on a chessboard" was asked before, the link is here. The code review is so great and Julia applied the tips from code review through the contest.

4/28/2017
After studying the test cases, Julia found one counter example of her assumption - her design flaw:
matrix
1 1 1 1 1 1 1
1 1 6 7 8
1 6 1 1 1
1 6
1 6
1 6
1 6 6 6 6 6 6
seconds is bigger than 14, for example 20 seconds, we need to count 6, 7, 8 for biggest path 1 1 6 6 6 6 6 6 6 6 6 6, extra 5 seconds will take a visit nodes 6 -> 7 ->8 and back to 6.

May 14, 2018
I reviewed the performance of the algorithm in the contest. I did spend over six hours, and submitted over 20 times to try to get more points. And I read the last submission with a few functions, in total there are more than one hundred lines of code. It is too complicated and not practical approach from my point of view.

I believe that the dynamic programming solution can be found and should be easy and clean code. I like to plan to work on this algorithm again, and test how good I can be compared to more than 12 months ago.

Here is my C# algorithm written using dynamic programming.

April 23, 2017

### Introduction

It was a beautiful day Sunday and Julia went out for Vancouver sun run. After 10 km running and walking, she was recovering quickly starting from 1:00 pm and then spent more than 60 minutes to study Google managers and directors, facebook managers and directors on linkedin profile.

Julia was noticed that last Friday at work and surprised that she did not pay attention to one of webpage she worked on. She spent over hours to clean up CSS class name and ID selector names, she planned to write a Javascript code to wrap all those data in html code, and then write a simple Javascript array or Json object file to get better organized.

Related to the last Friday work experience and Saturday booking woman tech contest, Julia likes to do a small study about current managers and directors in high tech companies through linkedin.

### Study of managers and directors

Julia does not have a concrete idea what to study and what to look for, she just spent first 20 - 30 minutes to read some managers profiles and then figured out their career path, and then go from there.

She watched the tennis professional players press interviews and also browsed more managers profiles.

4:08pm 4/23/2017

Article about Li Fan is here to join pinterest back to Sept. 2016. Techcrunch article is here about former Google image search director Li Fan joined pinterest in 2016. 3 minutes talk on youtube is here.

Five lessons of scaling pinterest - good time to read an article talking about lessons. Article link is here.

### Actionable Items

Watch again press interviews of tennis professional players - learn how to review player, what are the strong player showing in their talk, thought process?

Garbine Muguruza - semi-final press conference
Final press conference

Learn to play free, no fear;
Mentality - do not like the grass -> like the grass -> it worked.

French open final after defeating Serena Williams

Maria Sharapova - wimbledon semi-final press conference

Sharapova is a such a great speaker, and she expressed her idea so impressing and influential.

## Friday, April 21, 2017

April 21, 2017

### Introduction

It will be a busy weekend. Julia has to catch up tax return study and preparation this Saturday. She likes to do some study her own on tax issue and visit one of H & R block. But Julia just loves the competition and she likes to experience again the competition.

The contest will have another 30 hours to go. Julia will plan to work on at least 3 - 4 hours this Saturday.

Challenges are here.

Read the article - Learn from the best player - Simran Dokonia, play to win, linkedin profile is here.

Now it is 4:05 pm, April 22, 2017. Julia solved a few problems. Here are the ranking progress report. Julia still has a few hours (15 hours) to work on. Tomorrow morning is Vancouver sun run, Julia has to go to bed early.

Julia felt much better because she is learning from every problem solving. She was busy to work on debugging the code and thinking, such a great workout.

4/23/2017 12:51 am

That is the best I can do. Here is the report:

### Follow up after the contest

1:58 pm, April 23, 2017

Julia read the above comparison, she spent over 860 minutes, almost 14 hours 20 minutes scored 88 points, whereas the 20th only spent less than 605 minutes, around 10 hours to score 245 points.

The 20th player scored extra 157 points from 88 to 245 points, and also spent less than 5 hours compared to Julia.

One thing Julia found out is that players are very consistent on the performance. To compare with top 5% performers, Julia has to catch up more skills - reading, debugging, design of the algorithm and data structure, etc.

### Fire code practice website

April 21, 2017

Plan to spend some time to work on https://www.firecode.io. Julia was recommended to practice on this website.

## Thursday, April 20, 2017

April 20, 2017

### Introduction

It is a good idea to prepare tax early. Now it is only 10 days before the deadline - April 30, Julia has to push herself to work on tax return.

April 21, 2017, first time Julia has to visit a H&R block in Canada. Get educated and informed about tax laws.

## Wednesday, April 19, 2017

April 19, 2017

### Introduction

It is a good practice to write down a simple test case, and go over the test case and explain the algorithm, write down every step and every detail to show how you are serious about the talk; show some good analysis by writing down some notes, like mathematical expression, some terms about computer algorithm, and things like pseudo code will be perfect because a person knows recursive function, her writing will terminate because one iteration is enough.

Julia recalled her only experience in 2016 and then she knew that she should write down more transcript instead of code. Try to put 10 minutes in coding writing, first 10 minutes to write down the problem, and everything to ensure the problem is communicated properly, and also the idea will help to lead a bug-free solution.

Julia learned in April after 5 or 6 mocking experience, suddenly she did not scare at all. She likes to play free and use this non-algorithm approach.

Recursive function or DFS algorithm is the most popular algorithm Julia learned to master in 2017.

### Recursive function

Transcript is here to review.

Transcript is being compiled to a new version. Here is the C# code.

April 19, 2017

### Introduction

Flood fill algorithm is a term Julia learned through wiki article reading in 2017. Julia learned the algorithm through various situations and found out that it is very important to follow the structure to practice. The structure she follows starting less than 1 month is to start from one small example, work through the example. If Julia has 30 minutes to work on the algorithm, she will spend first 10 minutes to work on a small example, go over the problem and think out loud with ideas to solve the problem, write pseudo code, and walk through some test cases. To show the intelligence, Julia will write down something to help herself track the progress. And next 10 minutes to write the code, and 10 minutes for potential issues.

As showed in the following transcript, Julia went through the sample test case, and then counted one by one island and marked them using A, B, C, D, E, F. And then she went over the detail in 10 minutes to write and communicate ideas through her writing. She likes to write and reminds her to go through everything in her preparation to a perfect bug-free coding stage.

Good conversation is like this, Julia said that there is 5 of islands, the peer said that it is six. So Julia just marked one by one using A to E, and then she found F at last moment. It is called cognitive ability, both of players know each other through counting activities. Good warmup. Julia did very well on this, showed that she could collaborate very well, adapt to uncertainty and learn.

### Flood fill algorithm

Here is the 30 minutes transcript in mocking experience.

Julia tried to make the code more clear as possible, and she should push the code to the visit function.

Code review after the practice, fix grammar errors, code is here.

Make the code less verbose, and short. Here is the code to add extract a visit function.

Here is the progress report, the 30 minutes transcript has been worked on to fix grammar errors first, the compiled C# code is optimized to add extract visit function next.

### Actionable Item

Read the article one more time, Google hire, write down notes here:

General cognitive ability - the capacity to learn, the combination of raw intelligence

Argument 2:
A diligent interviewer will probe deeply to assess the veracity and thought process - how to do it?

Argument 3:
People who score high on conscientiousness “work to completion”—meaning they don’t stop until a job is done rather than quitting at good enough—and are more likely to feel responsibility for their teams and the environment around them.

April 19, 2017

### Introduction

Julia chose a small study topic about app academy to end her busy day, 2 more hours to go. She had a mocking experience tonight at 8:00 pm and wondered how the peer performed so well. And then she found out a new topic for study tonight. The peer went through the training of App Academy. So interesting to know a new academy institution, very creative, 4 months training, no tuition until you find a job in 12 months after graduation, is that cool?

## Tuesday, April 18, 2017

April 18, 2017

### Introduction

It is interesting to know that the advanced algorithm in hackerrank week code contest sometimes is purely a mathematical analysis problem. The score of the algorithm is 100. Julia likes to be able to solve one of them in the short future.

Today Julia likes to study if Euler algorithm on Hackerrank is good choice to practice. Mathematics is a golden mine, if Julia starts to work on the math again, she may find herself to be able to score extra 100 points on hackerrank week code contest.

Based on the experience to work on algorithm "Colliding Circles" in week code 31 contest, Julia learned and practiced one more time how to write clean and efficient DFS algorithm using recursive function. Those 5 hours she experienced a lot to construct a DFS - recursive function.

It was very exciting to make a small change in the two submission, solved test case 4, scored extra 3 points from 8 to 11. Julia learned to be extremely patient to learn to write best recursive code. The experience is documented in this blog.

Here is the short story of reducing time complexity of calculation O(n2) to O(n). There are n balls, any two can collide, so there are total n x (n-1) options; each collide the area gets increment of 2 x ri x rj, sum (2 x rix rj) is O(n x n) time complexity. Since n is 105, so n x n will be 10000 million; time complexity will be lowered from 10000 million of multiplcation to 100000 calculation of summation. As showing in the following code snippet, the difference of two summations is the 3 hours work/ 3 more points, (r1 + r2 +...+ rn)2 - (r12 + r2+ ... + rn2).

More detail please refer to the colliding circles source code line 82 - 87 for extra 3 points. However, using mathematical analysis, the algorithm can be designed with time complexity lower to O(n). It was hard to get it in the contest.

One player did a lot of Euler algorithm heavily recently, the player got mathematics' Ph.D. degree from 1996 to 2000. Julia was wondering if she can learn something from other player's practice.

### Algorithms

Those Euler algorithms on hackerrank may be a good place to practice good mathematical problem solving.

Here is the leaderboard Julia tried to study next 30 minutes - 10:06pm - 10:36pm. Who are those talents? What are the motivations to have those talent group? Name 3 of them and try to find motivation behind.

Top player Yuehang Chen - profile is here.
Yuan Li, profile is here.

Take a course - mathematical thinking on coursera by stanford university professor -  keith devlin, or read a book called mathematical thinking.

Cracking the coding interview on hackerrank

### I have fought the good fight

Show the first silver medal. And also, read the article about Timothy 4:7 (ESV) “I have fought the good fight, I have finished the race, I have kept the faith.”

## Monday, April 17, 2017

April 17, 2017

### Introduction

It is a wise decision to study the leaderboard for at least 30 minutes after the contest compared to those long hours to work on contest to get a silver medal day and nights. Julia did like to look into range of 300 - 800 as well, certainly she likes to study those top 300 range.

One of the players shares his blog who score over 200 points compared to 90 points Julia made.

The first one is the second year university student in Zhejiang University, China.

### Code blog

Hackerrank profile is here.

Coding blog is here.

### Taste like winning

The algorithm is one of advanced algorithm, last one in Hackerrank week of contest 26. Julia did not attend the week of code back to Nov. 2016.

100 points - DP, game theory - Hackerrank contest is the real mathematics, statistics, game theory competition.

The coding blog taste like winning is written in Chinese, and the author talked about his analysis about the algorithm. Quiet interesting! His ranking of week code 26 is 676933.

April 17, 2017

### Introduction

It is a very good practice to spend over 5 hours for each hard algorithm in the contest. Julia now has chance to do some research how to improve contest performance,  study how to improve 30% performance to 100% on those two algorithms.

Three algorithms are showed in the following image:

Julia plans to take some time to review those algorithms and then write down small tips to help her to improve.

## Sunday, April 16, 2017

April 16, 2017

### Introduction

It is the first time Julia spent over 2 hours in the week contest to work on an advanced algorithm in 2017.

### 2 hours Research

Julia likes to challenge her research ability to work on an advanced algorithm, and try to come out ideas, simple code, and try to break zero - score any point if she can. At 8:47 pm 4/16/2107, there are over 1095 players score more than 8 points, maximum score is 72.

Follow through the discussion, the brute force will be able to score 8 points. It is not a bad idea to come out the brute force solution first.

### Binary index tree

Here is the code review question Julia posted about Hackerrank kindergarten adventure.

April 16, 2017

### Introduction

Problem statement: Colliding Circles

It is a good challenging to make some progress on this colliding circles algorithm. Julia spent over 5 hours on this Sunday after church service around 1:30 pm, up to 6:54 pm she managed to make the code work using recursive solution first, and then continued to improve time efficiency. Here is the progress report on this algorithm. At the end of day, the score will go lower after all test cases are run.

It is a good training to learn how to stay calm, and review the time complexity, how to lower O(n*n) calculation to O(n) calculation. Julia tried to get more training on recursive function - DFS search algorithm.

It took Julia more than 6 hours to work on coding and then the algorithm can pass second sample test case and scored 8.78 first time at 4:00 pm this Sunday afternoon. So as a programmer, Julia also liked to be nitpick at her code and then questioned her practice, and then solved test case 4.

So exciting that Julia can bring herself first time in top 10% in the hackerrank contest, she could figure out how hard it takes to get a silver medal.

It is also very good practice to warm up simple probability knowledge when coding this algorithm. Once Julia figured out the probability is important in this algorithm, she started to make points on the algorithm.

### Coding is fun

Julia only has 3 hours left for the contest, she has to finish everything before 10:00 pm. Now it is 7:18 pm.

Use some bible verse to celebrate the learning of the algorithm, favorite verse from proverbs or psalms.

### Follow up after the contest

April 17, 2017 9:19pm

Code submission is here, score 11.28, extra 3 hours hard work.

First submission with a score is here, score 8 after 5 hours work, score 7.82 out of 65.

## Saturday, April 15, 2017

### Leetcode weekly contest 28

April 15, 2017

Leetcode 28 weekly Contest webpage

Julia spent 90 minutes to play contest of Leetcode weekly contest 28. She was too busy to read the problem statement and then she never felt that 90 minutes can fly that fast. She just could not believe that she is doing better than week contest 27.

Here is the picture to show some result.

### Actionable Items

Try to figure out how to make sense those problem statement on Leetcode, too much wording but Julia could not understand the last 2 algorithm.

### Strategy talk

In the contest 90 minutes, Julia took turns to read last 3 algorithm and could not understand any of them, she did more than 3 rounds, and then she decided to give it a try second algorithm. She understood the math very well and just could not believe that it is a medium algorithm, it is so straightforward, she thought about a lot of ideas at the first.

She was training herself to read problem statement, do not give up, keep reading and thinking, round robin fashion on those 3 algorithms.

### Statistics of the contest

Score is 9, Julia solved first two algorithm in first 80 minutes. Rank is 393/ 1848, score 9's range is  from ranking 170 to 393.

April 15, 2017

### Introduction

Julia worked on mocking experience starting from April 1, and so far she had 8 experience. What did she like most?

She just checked this video about tennis, what do you like most about tennis. The video is here.

Tennis is last real gladiator sports left.
Even gentle guy likes to crushing experience ...?
Love competition
Atmosphere is just great!
Sound of hitting balls on sweet spot.
What do you like most?

So Julia likes to relate to algorithm and data structure mocking experience, and what she loves most about the experience.

Learn from most talented peers how to perform the problem solving.

### Small talk

Real fun to go up-and-downs with score, rank from 1 to 7.
Good experience to journal and then make it better next time.
Met people and had big surprise how talent people are.

Let us read some report and get it serious. Understand the performance like sports, win or lose not controllable, understand what is bias and how to fight against odds to show some real work.

Work with people is most difficult part as a software programmer. Julia likes to learn how to work with people and then she can focus on more on technical skills.

Learn to play better mocking experience. One a time.

### Facts to remember

April 11, 2017, Know something, Score 1 - "Do not write code until you have a clear algorithm in your head"

In other words, Julia, it is a good idea to write pseudo code first before you write real C# code. Then you can review your algorithm design, clear out any mistakes in thinking process.

Forgot to write base case for DFS algorithm - recursive function in her first writing and then she quickly added it after the reminder. The algorithm is called sudoku solver.

April 15, 2017

### Introduction

Julia was busy with Hackerrank week code #31 this morning starting from 8:00 am and she had some issues about her attitude to test cases, last night she stayed up to 1 am to work on coding with test cases. She failed 50% test case of minimum spanning tree, and she thought that this Saturday morning time is the wonderful time to learn how to strength her test skills, she tried to fix those failed test cases today.

Last night 10:00 pm she had a mocking experience but she felt kind of disappointed, because she liked to get more mocking comment. Last night she did not get optimal solution. She could not think freely to reach optimal solution.

But today 10:00 am mocking experience is a very good experience, best of 8 mocking experience. She spent over 10 minutes to work on time complexity analysis, O(k2) -> O(klogk) -> O(k), she stopped before she thought about O(1), she knew that it is not so good to find minimum value using O(k) time. She asked for a hint, and then she was given to think heap sort. She got it right away, O(1) to get the minimum value if minimum heap is used to store k elements. Because all k numbers does not need to be sorted, only minimum value is needed.

Using O(k) time to get minimal is not optimal, use space to trade time, use a binary tree - a data structure to store k element, minimum value is the root of binary tree, that will be O(1) time. Actually it is named minimum heap.

### Small talk about messed array

The 30 minutes mocking experience is here with transcript, thought process, hint given and C# code.

### Actionable Item

This is the first time in last 8 experience Julia got rate of 7 for her code. 30 minutes is long time for a conversation. Writing code was to write down what she described in the test case. Even though Julia worked on first 10 minutes without coming out using heap sort, she understood the solution and how to approach the problem by going through a simple test case [1, 2, 3, 4, 5].

"Really familiarize yourself with the sorting algorithms. You definitely understand them but get to a place where you can recall them more intuitively."

### Facts

The problem is so subtle and then Julia did not come out using heap sort, even though she wrote about the algorithm of search medium using O(1) about a data structure a few days ago.

June 28, 2017  8:00 pm - 8:30 pm
C# practice code is here.

## Friday, April 14, 2017

### Hackerrank: Colliding Circles

April 14, 2017

Problem statement: Colliding Circles

Work on the algorithm.

Plan to spend 2 hours to work on algorithm 4:00 pm - 6:00 pm.

### Discussion

Julia read this comment and try to learn from the sharing.

blubberdiblub

5 lines of code - math - combinatorics, full score

recursive - get 10 points

recursive and memorization - get 32.50

### Wishful thinking

Stay outdoor and enjoy sunshine and tennis sport this beautiful day in Vancouver - Easter holiday

### French Open

What is your first Impact of tennis game?

Impact The Game: What Makes Your Game Unique?

Setting the scene for Roland Garros 2015 feat. Ana, Simona, Jo and Fabio

US Open: Behind the Scenes with Ana Ivanovic, Simona Halep, Jack Sock & Jo-Wilfried Tsonga

April 14, 2017

### Introduction

It is a good practice to track the progress, now Julia ranked around 600 at 3:38pm 4/14/2017. She is still working on the algorithm, but she managed to pass some test cases and scored 24.75, first 7 test cases only 0, 1, 2, 6 test cases are passed. The score will be less because there are 7 more test cases.

Here is something she likes to show the progress compared to a Googler:

Right now, she needs to review her code, and read the problem statement a few more times and see if she misses anything important.

Julia likes to work on the next algorithm "Colliding Circles", it is fun and she thought about Combinatorics she learned in her mathematics study. She checked that another googler - yaray scores full score on this colliding circles algorithm.

### Follow up after the contest

April 17, 2017 9:11pm

The submission in the contest is here. Failed a few test case, only score 17.68 out of 55.

April 14, 2017

### Introduction

It is a good workout to work on Kruskal's algorithm based on the geeksforgeeks.com article.  Julia likes to spend 2 - 3 hours to play with Kruskal's algorithm using C#.

Later on, she likes to work on the algorithm on Hackerrank week code 31 - Spanning Tree Fraction.

### Kruskal's algorithm

Greedy algorithm to get minimum spanning tree using Kruskal's algorithm.

Spent near 2 hours to work on the C# code. C# code is here.

## Thursday, April 13, 2017

### Hackerrank: Spanning Tree Fraction

April 13, 2017

Problem statement

### Introduction

Julia likes to work on spanning tree algorithm, even though it is hard algorithm, but Julia did spend some time on the algorithm before. So, it is also a good practice to review previous contests related algorithms.

Julia started to read minimum spanning tree, understand why union set is better than DFS algorithm to detect cycle in the tree algorithm.

### Minimum Spanning Tree

Here is the tutorial she studied for the algorithm.
minimum spanning tree -  April 13, 2017

Hackerearth.com -> graph -> minimum spanning tree -> tutorial

Kruskal's algorithm -

Learn the algorithm - using disjoint set / not DFS

check how it is not connected? Using DFS algorithm to search - O(V + E)

### Value of friendship

Code review of algorithm "value of friendship" is here.

### Kruskal's algorithm

GeeksforGeeks article