Tuesday, April 25, 2017

Coding blog small talk

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 Opens up About Doping Suspension, Appeal, Return to tennis - Today video is here.
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

Hackerrank leaderboard study

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.

Leaderboard study - algorithm


Study the leaderboard. Link is here.
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.

Thinking techniques



From reading "Is competitive programming helpful?", a Quora question, Julia had chance to read another player's answer from the SFU computer science Ph.D., Mstafa Saad, and she read the article talking about thinking techniques.

Training style - discipline monitoring


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

Actionable Items


Study shanghai business - https://www.dianrong.com/

Sunday, April 23, 2017

Visiting Manhattan - Booking woman in tech

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.

Minimum Heap - C# practice

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.

EmailsEverywhere - booking woman in tech

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.

B.Available - Booking woman in tech

April 23, 2017

Introduction


Code review 


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

Manhattan 2 - booking woman in tech

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.

Follow up 


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.

Linkedin study - managers and directors

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

Rajesh - linkedin profile

Li Fan - linkedin profile

Vanja - linkedin profile

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?

Agnieszka Radwanska - Wimbledon

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

Booking women in Tech

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.

Another comparison is here, read Zheng Xu's blog about facebook hacker cup round 2.

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

Tax, tax, tax

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.

Tax return



Wednesday, April 19, 2017

Recursive function small talk

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.

Flood fill algorithm small talk

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.

App Academy

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?

App Academy 


Read 10 - 30 minutes first. App Academy on linkedin is here.


Tuesday, April 18, 2017

Mathematics and hackerrank week code contest

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

Competitive players of week code 31

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.

Hackerrank week code contest 31 small talk

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.

Study after the contest 


Read one hackerrank player's blog about contest. Link is here.





Sunday, April 16, 2017

Hackerrank: Nominating Group Leaders

April 16, 2017

Introduction


Problem statement: Nominating Group Leaders

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. 


Hackerrank: Colliding Circles (II)

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.

Study the leaderboard.

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.


What do you love most about mocking experience?

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.

Messed array k step away small talk

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. 

Follow up 


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

comment about colliding circles -

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

Hackerrank: Spanning tree fraction

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.

Kruskal's algorithm workout (I)

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

Code preparation 



Hackerrank zero-one game

April 13, 2017

Problem statement

Introduction


Julia liked the algorithm very much. She calmed down and worked on the algorithm more than 2 hours.

Here are her submission results. She has to wait until the end of day, the score will go down more since only first 7 test cases are counted.

Here is her report on one of submissions at 9:31pm 4/13/2017:


Follow up after the contest


April 17, 2018 9:08pm

Code submission in the contest, score 24 out of 40, pass 10 of 14 test cases. Code is here.

Hackerrank week code 31

April 13, 2017

Introduction


Julia learns to stay in the contest and enjoys the hard work to solve some problems. Here is the status at 9:17pm 4/13/2017. Julia compared to the best performer.


Hackerrank Week code 31


It is not easy to  gain any point on advanced algorithm beyond medium algorithm on week of code contest. But Julia found out that she started to learn a few algorithms last 12 months. One of her favorite learning is binary index tree, so much up-and-downs feelings with the learning, but she wrote a very good question kindergarten adventures on code review website. She learned that she should not trust her feelings, it may seem to be difficult, but with calm and systematic way to handle the algorithm, use her strong data analysis experience, no algorithm should be hard. No mountain is too hard to conquer. 




Tuesday, April 11, 2017

Sudoku solver talk

April 11, 2017

Introduction


Sudoku solver is such interesting problem and Julia wrote more than 3 solution in her practice back in 2015. Here is one of the blogs, and also Leetcode 37: sudoku solver is also very good material to review the algorithm.

Sudoku solver talk 


Here is the C# code written in 30 minutes mocking experience.

Transcript is compiled to make it work. C# code is here.

Highlights of a few corrections:

3 nested for loops. The first 2 for loops is to find the first cell with value -1 to do search, try numbers from 1 to 9 and start a DFS search, if all of them are failed, then return false; otherwise return true.

Need to talk about optimization, use the first one with value -1 to start DFS or other cell?


Follow up

Sept. 6, 2017

It is very important to learn the algorithm. Start from code review and learn from the important message in the review.




Daily reading on code review website

April 11, 2017

Introduction

It is a good idea to read some articles about algorithm every day. Julia chose to follow a few users who reviewed her algorithm questions before.

Here are the list she followed today.

Peter Taylor

Ariano Repetti



Daily reading time


Sunday, April 9, 2017

Find string using slide window - a small talk

April 9, 2017

Introduction


It is exciting to write the sliding window search algorithm with time complexity O(N),  N is the string's length. The similar algorithm is here on geeksongeeks.com, and also it is very close to the Leetcode 76: Minimum Window Substring.

There is a short story about the sliding window algorithm. Julia still remembered that 2 years ago in 2015 January, Julia asked to get her first onsite interview after a tech talk social event, she could not pass phone screen from top four software companies, Facebook. But she likes to find out what if she has one onsite interview and what she should learn.

She was asked to solve the algorithm to search a minimum substring as the second algorithm, but she failed to solve the problem on onsite interview and she could not write any code with a lot of hints. This is the first onsite coding interview she managed to get in the city of Vancouver after working full time over 5 years.

After a week analysis of the algorithm, Julia decided to start to write a coding blog, practice coding every day.

A coding blog starting January 2015


The only way Julia can think about improving the algorithm and data structure problem solving is related to learn from her tennis sports practice in the city of Vancouver. What she did is to work on tennis sport practice over one hundred hours, two hundreds hours, and then she started to play double matches and met over hundred people on the tennis court.

She understood that onsite interview is such a great help for her to understand that she needs to make life style change. She needs to find those people working hard on algorithm and data structure practice, work on something together, practice together.

She likes to give back to others, shows her generous to share, most likely she will share her failure, struggle at the beginning.

She started to write day by day, now her coding blog is like a tree planted by the water that sends out its roots by the stream (Jerimiah 17:8).

Here is the blog about the algorithm to find minimum substring using sliding window technique written 2 years ago, January 2015. This is the time Julia understood that it is important for her to start to write a coding blog to help herself. She felt so frustrated on the onsite interview but she quickly learned something related to her tennis sports practice.

This time Julia came out the idea in less than 1 minute, but she still needs to work on a few implementation details.


Code review and study 


Julia wrote 30 minutes about an algorithm to search a string using slide window in the mock interview. The code has some issues and she could not finish the algorithm. First she likes to code review her algorithm.

C# code is here at the practice, it took 30 minutes to write.

Will work on code more after the practice, here is C# version - revision 1.
Will add some test case to make sure the code is perfect.

4/9/2017
Added a test case, debugged the code and found a bug, C# version - revision 2.
line 72 - line 103 - code smells, duplicate logic in if/ else both cases.

4/10/2017 10:28pm
Continue to make code more clean, readable. The code smells in revision 2. Move left pointer loop standalone. C# version - revision 3.

6/30/2017
Fix the bug in the code, add a few lines of code 98 - 101. The C# code is here.

Code Review 


C# code is here at the practice.

Highlights of good things and bad things in the code written in mock interview 30 minutes:

1. line 2 - 19 writing of algorithm analysis is very good.
2. line 2 - 19 missing the slide window left point move forward design - skip more than one char
3. line 63 - 65 - this is a bug, for example, unique string "xyz", slide window "xyyz", if next char is x, then "yzx" will be shortest. It is a bug to reset start and end pointer.
4. line 74 - 76 - if statement should be a while loop
    need to add checking whether minimum string is found or not.

Final version after mock interview experience is here. C# version - revision 3.

Fully understand the test case first


In order to write good and working code, Julia had to force herself to work on a test case first next time. Here is the test case she worked on April 11, 2017, a few days after mock interview experience.

Work on the simple test case again and again, write down the analysis here (4/11/2017):

Find string using sliding window

xyz     xyyzx

Iterate the string one char a time
x
xy
xyy
xyyz
xyyzx

When to move left pointer? skip two chars in a row - "xy"

xyyzx -> yyzx, remove left pointer, skip x 
yyzx -> yzx,     remove left pointer, skip y

Do one thing a time. Every iteration, add the visited char to the slide window, add char to the slide window if it is new, otherwise increase the count.  Check left pointer to see if it can move forward, make sure do a loop, sometimes it can skip multiple chars. Check if slide window contains a string including all unique characters.  

Actionable Items


1. Study the discussion of Leetcode 78.



On the other hand, seeing you find your way out of a difficult situation tells a lot about your character, how you perform under pressure, your ability to think on your feet and your problem solving skills.

1. Not thinking about an algorithm

Make things simpler for yourself. Write down an example on the board and think about just solving that particular instance of the problem by hand.

Small test case -> generalize it back into an algorithm form. 

Julia, please validate the argument. Sounds like true to Julia in 2017.
People tend to bomb their first few sets of interviews. This is mostly because they don’t have sufficient practice with how to handle that pressure of solving an unknown question.

15 mock interview - systematic way
 

Actionable Items


Related blog in Chinese - sliding window algorithm, link is here

Follow up 


June 29, 2017

Mock practice again, C# code is here.

Need to write some test case and make sure that the code is working.


Australia Open 2017 - Press conference on and on

April 9, 2017

Introduction


Coding is a lonely game even Julia worked on code review website and also had mocking experience, sometimes Julia missed the physical experience of tennis sports, people meet on the court and exchange ideas face to face.

Julia has to deal with different emotions when she goes through coding and full time job. She likes to keep learning. One thing she starts to try first time and write a blog is to watch the press conference of tennis player after each round of Australian Open 2017 and document her learning.

Watch one talk a time. Roger Federer had over 5 press conferences. Try to catch up some thinking process of top players, deal with loss, win, emotion, health, practice, everything.

One thing Julia likes to work on is her interview skills, give her a talk, she found out that she is better to learn from top professional players. More real, more related to her reality, she likes to seek open fair opportunity to advance and grow her career, by hard working and showing what she learns through a lot of practice.

Study how players analyzes their game


Roger Federer 

1. Roger Federer Pre-Tournament Press Conference  - 8 minutes

underdog? as long as healthy, have opportunity to play, underdog is fine

2. Roger Federer - SF press conference

3. Final press conference

Play the ball, not your opponent. Problem solving mindset. Play free, brave will be rewarded here. Mindset the coach shared with Roger.

4. After final vs Warinka - Indian Wells 2017 - 15 minutes

Before he has favorite, now enjoy every week. Building block of his career?

Mental challenge? Dubai in lockroom, need more time off before Miami. Lack of energy. From zero, finished middle night. Felt right away, good. Last Nov., Dec., set some goals for season, top 8 in the season. Give me time to get there. Reassess the goal, where is the plan?

Stage of come back? Confidence does wonder. Too much fun, how hard it is to work on. ...

Play vs not play? Play more or less?

Grigo Dimitrov


Grigo Dimitrov - SF press conference

Notes:

Try to focus on my game when I was in the court. How simple it is that. Cannot control ...

Feel good, compete great! Appreciate my run so far. Give myself a little bit credit.

Talk about loss against Roger, over 4 hours. Great player do, over long hours.

Game plan ....

QF press conference


Stan Wawrinka

SF press conference

CoCo Vandeweghe

CoCo Vandeweghe press conference (SF)



Saturday, April 8, 2017

Leetcode 554: Brick Wall - contest experience

April 8, 2017

Problem statement

Julia spent less than 90 minutes to work on the algorithm in Leetcode week contest 27, from 6:30 pm - 8:00pm. 


Her C# code in the contest is here. Need to work on more on this medium algorithm, Leetcode 554.

Actionable Item


3 medium algorithm, each takes 20 minutes. So, the code should be less than 50 lines for each algorithm.

Time just flies too quickly when Julia worked on Leetcode 554. She managed to work out the sample test case, but it does not pass Leetcode online judge.

Will work on improvements later. 


Analysis


Julia, you should think about using min heap to track line sweep algorithm, therefore no run time error, which is probably timeout.

Design flaw 

Her C# code in the contest is here.

Time complexity of algorithm Julia implemented, every node is visited more than once at least, upper bound is not sure, some node is visited multiple times; upper bound cannot be determined. 

Better to choose the algorithm only visits each row each brick wall once algorithm, the time complexity is deterministic.

Lesson learned

April 10, 2017 10:00pm

Julia did not notice that her choice of algorithm had timeout issue. The upper bound of the algorithm cannot be determined.

Actionable Item

April 10, 2017
Julia, you over engineering the algorithm. Make it simple and quick.

Julia, you have to measure the algorithm by your engineering power, determine which idea to go for it depending on time constraint. 20 minutes does not allow more than 50 lines of code, bug-free. It is impossible.

April 11, 2017
It should be your routine before you write any algorithm code, try to analyse time complexity.

Leetcode 521: Longest Uncommon Subsequence I

April 8, 2017


Study the article: Longest Uncommon Subsequence 1





Tennis player study - Mirjana Lucic-Baroni

April 8, 2017

Read the article: Journey from Grand Slam title, financial crunch and back.

Wiki article: Mirjana Lucic-Baroni




Leetcode weekly contest 27

April 8, 2017

Plan to play leetcode weekly contest at 6:30 pm. 90 minutes contest.

First time to join the contest.

In 90 minutes, Julia finished first two algorithms, but second one she came int runtime error.

Her C# code in the contest is here. Need to work on more on this medium algorithm, Leetcode 554.

Actionable Item


3 medium algorithm, each takes 20 minutes. So, the code should be less than 50 lines for each algorithm.

Time just flies too quickly when Julia worked on Leetcode 554. She managed to work out the sample test case, but it does not pass Leetcode online judge.

Analysis of Leetcode 554


Julia, you should think about using min heap to track line sweep algorithm, therefore no run time error, which is probably timeout.

Julia's Argument - 2 cents after her first contest 


Leetcode has more fast pace to develop new algorithm and bring into a lot of players compared to Hackerrank, therefore 2017 Julia should spend more time to play with Leetcode algorithm.