Friday, June 16, 2017

Bonnie and Cylde - week of code 33

June 16, 2017

Introduction


It is the expert level algorithm and Julia likes to work on the algorithm. 


Expert Level


Julia chooses to work on the expert level algorithm, Bonnie and Cylde. She chooses to study graph algorithm for a few hours, and then tries to find a solution. 

First, she reads the topcoder graph blogs. Blog link is here. 

Next, she will search all graph algorithm in Leetcode marking hard level, she will quickly go over 5 - 10 of them. 


Third, undirected graph lecture notes - link is here. 

Fourth, detect cycle in directed graph, link is here. Detect cycle in undirected graph, link is here. 

Fifth step, go over graph algorithms on geeksforgeeks.org website. The link is here. 

One of graph algorithms, "Print all paths from a given source to a destination". The blog is here. 

"Competitive Programming" authored by - Graph

Union find algorithm on hackerearth - link is here. 




Progress Report



Now it is 8:44 am Saturday morning, Julia has to review her submission result. The interesting part of expert level algorithm is that Julia has to go over a lot of content about graph, a lot of reading, and then she decided to use one of algorithms to solve the problem. 

The idea to solve the problem was original wrong, and then she made a minor change to make sense on second sample test case. 

The another interesting fact to write code for expert level algorithm is that Julia does not have a lot of code to write. The idea is quiet simple, but a few test cases timeout. It is hard to find the right idea. Julia has to do time analysis for the algorithm and see which one can survive the time limit. 


Follow up after the contest


Julia submitted the code in the contest and score 25% of maximum score, 22.86 out of maximum score 80. Julia just used union find algorithm and then used another idea to apply union find second time to exclude one of two source nodes. Code is here. 

Thursday, June 15, 2017

Leetcode 516: Longest palindromic subsequence

June 15, 2017


Work on Leetcode 516: longest palindromic subsequence

Julia's C# practice is here.

Palindromic table - week of code 33

June 15, 2017



Here is the progress report of the algorithm at 10:05 pm.



Now it is 10:41 pm, Julia checked the edge case:

1. A single digit is a valid palindrome.
2. Note that a sequence of only  element can contain , but  is invalid as it contains a leading zero.

Julia fixed the bug related to edge case, now she scored 60 out of maximum score 60. Very good, Julia started to go over the problem statement and found the bug. She checked that scores on leader board from 50.00, 51.67, 53.3, 56.66, 58.33, 60.00.  Last time she scored 50.00. So she tried to find small edge cases, but she found all of them. 



Progress report


One thing Julia learned through the algorithm is that she has to take care all small edge cases, she failed test case 40 and 41, and then she figured out the edge case and submitted on June 16, 2017. 

Now it is 8:53 am. And Julia had one test case with timeout issue, she has no idea to solve the issue. 

To play the contest, Julia learns a few things, one thing is to write down test cases for small edge cases. Think carefully. 


Follow up after the contest 


Here is the code submitted in the contest, which passed all test cases except timeout on test case 30. 




Hackerrank week of code 33

June 15, 2017

Week of code 33 on Hackerrank

It is so exciting to play hackerrank week of code 33. Julia likes to check her progress through the contest.

Here is the progress report on June 15, 2017, 10:08 pm.


Now it is 10:59 pm, Julia scored 60 maximum score on the algorithm "Palindromic table". Her ranking moved up to 431. 


There are 2 more expert level algorithms to go for the week of code 33. Now it is 11:15 pm, Julia checked the leader board in Canada. Here is the progress report:



Now it is Sunday, June 18, 2017, 8:15 am. Julia likes to ensure that she can get a gold medal, stay in the top 4%. So she plans to do more study and write some code for the algorithm. 

Here is the comparison to one of top players. 




Leetcode 300: Longest increase subsequence

June 15, 2017

Introduction


Plan to review the longest increasing subsequence algorithm again. It is getting much easy to work on the algorithm on Leetcode, the discussion of Leetcode 300 is Julia's favorite. Most of important job in the practice is to go over different ideas and seek the inspiration to solve the problem. It is the great to know one more idea, one more tip to solve the problem, and also go over different language.

There are over 70,000 accepted submissions, look at the statistics, Julia found out that it is a really home to the algorithm. Just dive in, get 30 - 60 minutes first round study. Do some research.

Algorithm problem solving



Julia's C# solution using binary search is here.

Julia's C# solution using dynamic programming is here.

Actionable Items


Work on Leetcode 516: longest palindromic subsequence

Julia's C# practice is here.

Wednesday, June 14, 2017

Transform to Palindrome - week of code 33

June 14, 2017

Introduction


Problem statement is here. It is a medium level algorithm, it is related to subsequence, it is about palindrome, and it is also to find the longest possible palindromic subsequence.

Code preparation in the contest



June 15, 2017 10:05 pm

Here is the progress report of the algorithm:


Follow up after the contest



The code submitted in the contest is here.




Binary tree root to leaf path minimum path value with the path

June 14, 2017

Introduction

   

It is very interesting to practice binary tree path sum with the same value. Julia did the practice in 2016. Today she did practice twice, first she rewrote the algorithm better to represent her understanding the algorithm - the recursive function.

And then she practice mocking experience, she wrote an extended algorithm to find the minimum path sum from root to leaf, the return value is the minimum path sum and also return the path.

 

 

Code practice 

 

3 practices: 

 July 28, 2016, C# practice

 June 14, 2017, C# practice

June 14, 2017 9:49pm  - C# practice

In 3rd practice, Julia was asked to extend the algorithm in the mocking experience, add the minimal sales path to the output as well. 

It is again the opportunity to practice how DFS works, use a string variable to track all the nodes in the path. 

 

Tuesday, June 13, 2017

Leetcode 79: Word Search

June 13, 2017

Problem statement


Julia's C# practice is here. The code passes all test cases of Leetcode online judge.

Work on basics

June 13, 2017

Introduction



It is better to work on the basics instead of taking new technology as part of arsenal. Julia likes to work on Http protocol learning, CSS foundation, JavaScript foundation, work on more and then start to explore new technologies. She still remembered that back to in 2014 she spent over 5 months to learn JavaScript every day. She decided to learn a function language and then she followed the book called JavaScript the definitive guide.

What to work on 

Leetcode 212: Word Search II

June 13, 2017

Problem statement

Introduction



Trie is the kind of tree data structure and easy to save space with common prefix. Julia spent over 5 hours to work on one of trie algorithm and posted a code review on stackexchange.com called prefix neighbor. She went through the trie and learned that the trie can be in any form.

This time Julia had to relearn trie again. She had the weakness of data structure Trie, she could not figure out how to solve test case 36 and 37 two test cases timeout issue.

Code practice 


It is the hard level algorithm.

Julia worked on the Leetcode 212 word search.

Her first submission failed last 2 test cases from 36 - 37. Timeout issue. Julia did not know that she needs to use trie, she just used recursive function. The code is here.

Here is the C# code.

She studies the discussion written by a Googler - Yavinci, and wrote second practice. Still work on the code for more testing. Here is the C# code.

Julia continued to work on the trie and here is the C# code passing leetcode online judge.


Algorithm talk - learn Trie again



It is interesting to learn how data structure Trie to help solving timeout issues. For example, there are a lot of words like "aaaa", "aaab", "aaac", ...,"aaaz", Julia was so naive on June 13, 2017. She just goes over each word in the dictionary, and try to find each word using depth first search (DFS) recursive calls.

However the last 2 test case of 37 test cases time out. But Julia did not have idea how to solve it.

Julia needs to take a data structure coaching lesson again. so great to catch the opportunity.

As we can see, those words have same prefix "aaa", and the fourth char or last char is a to z. How to save the time to search, for example, if the path is the prefix of one word, then we need to continue to search.

Think about time complexity. My original solution (the C# code) is to go over each word, and then start to search board using DFS; so time complexity is related to how many words, each word is searched through board using DFS. If 26 words all starting from same prefix "aaa", then "aaa" will be searched in the board over 26 times.

The idea of using Trie, and then go over each element in the board, and then do DFS search against the Trie tree.

So preparation is the key, store all words to a prefix tree first.

Trie 


Plan to read Trie wiki article, review time complexity advantage of using Trie data strucutre.

A trie has a number of advantages over binary search tree. A trie can also be used to replace a hash table.

Topcoder using Trie - the article link is here.
Hackerearth tutorial about Trie - the article link is here.
Read 10 pages lecture notes about Trie - CMU lecture notes is here.

7th bronze medal, 9th medal on Hackerrank

June 3, 2017

Julia likes to celebrate her 7th bronze medal on the hackerrank, for the contest of Ad infinitum18.


Julia was so involved with the contest, every time she had to stay over midnight and tried to push herself to gain extra points. She kept her focus on the algorithm as long as possible, she knew that she will get very busy, and after the contest it is not easy for her to find time to follow up the algorithm with the failed test case. She wrote a blog to remind herself to keep a cheerful heart to play contest.



Monday, June 12, 2017

French open WTA double champions - Lucie and Bethanie

June 11, 2017

Introduction


It is a good idea to do some research on those two tennis double players and how they are so success on last 3 years, won 3 double grand slam double championship.

Julia met and watched Bethanie practice in China open last October in the city of Beijing when she took 2 weeks vacation in China. She experienced how a professional tennis player and double ranking No. 1 how she practiced and approached to the fans.

What to study



Stay together more than 2 years 6 months, won 3 titles. Both players are single players, and also in top 100 ranking. Both of them are playing double matches, and how they bind together.

Stay positive, have some experience, and win again.

Julia learns to be like a professional tennis player. The way Julia treats her contests on Hackerrank is the way tennis players play so many tournament. One just another one. Keep going. And also keep aggressive. Celebrate every small success. Take one game a time.

French open 2017 interview of Lucie and Bathanie, link is here. 4 minutes interview.
Watch the video with 50 shot rally - the link is here.

Double take - 3 minutes video link is here.

Mattek-Sands/ Safarova press conference (F) - Australian Open 2015 - 9 minutes 29 seconds video is here.

Safarova/Mattek-Sand post-match interview (Final) Australian Open 2017. 7 minutes video link is here.

Bethanie Mattek-Sands and Lucie Safarova visit the Live @ Wimbledon studio 2015. 8 minutes video link is here.


Actionable items


Write down some notes how those two players work together so well.

Saturday, June 10, 2017

Divisor Exploration 3 - Ad Infinitium18

June 10, 2017

Introduction



Problem statement is here. The algorithm is hard level, and it is a tree algorithm.

Now it is 11:16 pm, Julia plans to spend another 10 - 20 minutes to document some ideas after she read the problem statement and thought about the ideas over 30 minutes at least.

The value n is the root of tree. n value is defined using m, a, prime numbers. The ith prime ( i >= 1) is 2 ( i = 1).

if the input arguments are m = 2, a = 0, d = 1, then n = 18, because n = 22 * 32.

Algorithm talk 

Rational Sums - Ad Infinitum18

June 10, 2017

Introduction



The problem statement is here. The algorithm is expert level. Now it is 10:45 pm, Julia plans to work on the contest in next 90 minutes. She studied the algorithm problem statement more than 30 minutes, she fully understood the problem.

The best bet for Julia to do is to try to work on some coding, go back to basics, and work out the sample test case first.

In other words, only work on the subproblem,

1. b0 /(n + a1)(n + a2)
2. (b0 + b1 n)/(n + a1)(n + a2)(n + a3).

Algorithm talk



Parity party - Ad Infinitum18

June 10, 2017

Introduction



It is so exciting to see the computer science professor, Math Ph.D. graduate, and high performer all having great time to play the algorithm, 5 out 100 is also very worthy to go for it.

Julia easily stumbled on simple recursive function on real trial with people through the phone. She needs more challenge problem solving experience, therefore she can solve easy algorithm quickly.

Now it is 5:34 pm, Julia still has more than 5 hours to play the contest. Let her enjoy the algorithm.

It is called parity party. The problem statement is here.


Coding in the contest 


Try depth first search, using recursive function, some pruning technique. 6:49 pm, score 5.0 out of 100. Julia has to go out the play tennis for one hour. And she plans to work on the contest until 12:00 am, and then get up early in the morning to play from 5:00 am to 9:00 am.



Try to use memoization, dynamic programming to avoid overlap subproblems.

Try other ideas.

Keep trying!


Follow up after the contest 



It is Sunday, 12:01 pm. Julia likes to post her code submissions and also wrote something to help herself grow technical skills.

First one is to use recursive solution, score 0. The most important task is to write recursive solution, solve the problem first. Here is the code.

Afterwards Julia spend some time to prune the algorithm, terminate recursion tree early adding some extra checking. Code is here, score 5.0 out of 100.

It is so much fun to understand that how mathematics solves the most complicated problem but a programmer has no clue. Julia read editorial notes and then she was amazed that the difference between a talent programmer and a good mathematician with programming talent.

Here is the editorial note link.

Count Solutions - ad infinitum18

June 10, 2017

Problem statement

It is 2:50 pm, here is the progress report.


It is very good learning experience. Julia will try some ideas to solve the time out issues. Julia solved the timeout issue by going over the detail, using binary search etc. But now the issue is wrong answer.


Now it is 11:28 pm. The best bet is to work on this algorithm, try to figure out why the answer is not correct. 11 answers for test case 1 to 10, 12 are wrong answers. The maximum score of the algorithm is 40.

Follow up after the contest 



It is June 11, 2017 11:48 am. Julia plans to look into test case 1, and figure out that why her binary search algorithm failed the test case 1.

Last Sunday morning she worked up to 1:40 am and then tried to figure out why her binary search algorithm failed the test case 1 - 10. She had good reasoning to use the curve of binomial x2 + by analysis of top/ bottom node, two sides of top/ bottom node are in ascending/ descending order.

Julia thought about that it is most possible algorithm she could have gained more points if she can put some test cases in the contest.

Julia's C# code in the contest is here. Score 2.11 out of 40.

Julia's C# code in the contest using brute force, score 4.0 out of 40, code is here.



Tower 3-coloring - Ad Infinitum18

June 10, 2017

Introduction


Problem statement

It is the first time to play the contest related to mathematics. Julia likes the contest, and she has to learn how to use limited hours to work on things, she can learn more, practice more.

Coding in the contest 



Need to figure out why memoization has issue. It seems to be easy to figure out.

Progress report is here. Need to work on more hours on other algorithms.


Follow up after the contest



It is Sunday 12:07 pm. Julia had no idea why her solution failed some test cases. She solved the timeout using memoization for the first 1 - 1000 calculation, and then use power function to calculate. She will look into the test case and then figure out the issue.

The little Fermat theory is quiet interesting. Julia read the discussion board in the contest but after the contest she read the editorial note and figured out the formula.

But in theory her solution should work, she only scored 15 out of 30.

Here is the code submission in the contest.


Action Item



The algorithm and data structure interview has 3 parts, one is to problem analysis, knowledge and execution. Julia found out that her execution is weak part compared to her analysis part.

Need to look into her code submission problem on those failed test cases. Will come back later.

June 11, 2017, 12:13 pm.




Friday, June 9, 2017

10 steps to master dynamic programming (step I)

June 9, 2017

Introduction


It takes a lot of practice to learn dynamic programming. As a Leetcode player, Julia learns very patiently to work on Leetcode 123 - buy and sell stock, even at most 2 transactions. Julia has to learn quickly to use dynamic programming to solve problem, and then build a recurrence formula like a mathematician. She will figure out how to do it.

First step to learn again is to play this rename game on stackexchange.com discussion post.

Dynamic Programming should be renamed


Discussion is here.

Dynamic programming

Julia's favorite verse:

Smart recursion plus memoization leading to a faster algorithm.
How to recognize that a problem may admit a smart recursion and come up with it? A common case is divide and conquer.

A

Any recurrence whatsoever

D

defining the subproblems
recursively solving the subproblems

F
frugal bottom-up recursion

I
Inductive Programming
Reverse Inductive Programming

L

Linear programming, integer programming, semidefine programming
Extract a recursive structure from the problem, and write down as a recurrence ( modeling)
"Solve the obtained recurrence in a bottom-up way"  (algorithms)

M

Multistage planning

Multiway-Divide and Memoized-Conquer, and Merge all subproblems

Memoiztion

O
Overlapping-divide-and-conquer

R
Reverse Inductive Programming
Recursive view
Recursive horizon

S
Splice-and-combine

To go with divide-and-conquer

Or overlapping-divide-and-conquer


Smart recursion, but not tables "table and fill"

T

Tabular/ tabulated recursion
Tabular call caching

Tables are sometime used.
Dynamic programming over trees (Maximum independent set), it uses a tree, or in some cases a tree of arrays,
or an array of trees, or in some cases a Cartesian product of trees.

Actionable Items


Google some keywords in the following list:

frugal bottom-up recursion
Tabular/ tabulated recursion
Maximum independent set
Overlapping-divide-and-conquer

Study the ICPC coach website: a Utah professor with great performance on Hackerrank.

Thursday, June 8, 2017

Leetcode 123: Buy and sell stock III

June 8, 2017

Problem statement

It is hard level algorithm. And it can be solved using dynamic programming. It is challenging task to solve a dynamic programming algorithm.

Now it is 10:39 pm, Julia likes to choose a topic to do a short research, what you should do if the algorithm is too hard to solve? 30 minutes research.

10 steps to master dynamic programming


1. Watch a video to relax, I found one - google developer talked about competitive programming. Here is the link, 1 hour 44 minutes.

2. Read a math lecture note from brown university, lecture note is here. Read a mathematician web page and learn some research idea here.

3. Dynamic programming should be renamed. Discussion is here.

4. Read a median age article and talk about AWS - link is here.

5. Work on interviewbit.com dynamic programming problems, the link is here. (June 16, 2017)



Follow up 


June 9, 2017

Julia's C# practice is here.

June 12, 2017

Julia's talk about the algorithm design

It is a good ritual to talk about the design, make a story, structure the story the way easy to recall, and also very well structured highlighted with keywords using different colors. The true nature of dynamic programming reminds us spend more time to write a story, spend less time to write the code.

Here are the highlights of story to buy and sell stocks. One transaction, multiple choice of purchase time, how to find maximum value? how to introduce the recurrence formula?

First let us talk about buy and sell stocks algorithm here on Leetcode 123. As a recursive solution nature, we only need to discuss one transaction in the design. We need to consider when to purchase, when to sell.

One transaction leads us to think about the last transaction. The last time stamp index to sell or not sell the stock.

Assume that we sell at time stamp index, and we can purchase anytime before index, in other words, any j from 0 to index – 1. The overall profit can be expressed using  the profit based on j and then last transaction profit prices[index] – prices[j].
Let us talk about multiple choices, and what is the optimal value? Find the maximum values in all the options.

Next, let us introduce the recurrence formula. Define a profit function called profit(k, j), where k is the number of transactions and j is the time stamp. 


f[k, index] = max(f[k, index - 1], max(prices[index] - prices[j] + f[k - 1, j]) for any j in range of [0, index - 1])


Follow up 


I had a mock interview on January 28, 2018, and after the mock interview the peer shared with me how he learned the algorithm through $50.00 purchase of courses on algoexpert.io. I found this free lecture on the algorithm Leetcode 123: Buy and Sell stock III.

Leetcode 122: Buy and sell stock II

June 8, 2017

Leetcode 122

Julia's C# practice is here. 

Leetcode 121: buy and sell stock

June 8, 2017

Leetcode 121

Julia's C# practice is here. 

Wednesday, June 7, 2017

Leetcode 239: Sliding window maximum

June 7, 2017

Introduction


It is the third time to review Leetcode 239: Sliding window maximum. By searching the blog using Leetcode 239, Julia reviewed last two practices in 2015 and 2016. Here is the link.

This time Julia likes to go over Leetcode discussion on the algorithm, and then need to write down most important part - the analysis of using deque, the idea to prune the queue to make it minimum.

Algorithm talk


Julia's C# practice is here.

Read some discussions, take some notes for good comment:

The link is here.

We scan the array from 0 to n-1, keep "promising" elements in the deque. The algorithm is amortized O(n) as each element is put and polled once.

At each i, we keep "promising" elements, which are potentially max number in window [i-(k-1), i] or any subsequent window. This means if an element in the deque and it is out of i-(k-1), we discard them. We just need to poll from the head, as we are using a deque and elements are ordered as the sequence in the array.

Now only those elements within [i-(k-1),i] are in the deque. We then discard elements smaller than a[i] from the tail. This is because if a[x] < a[i] and x < i, then a[x] has no chance to be the "max" in [i-(k-1), i], or any other subsequent window: a[i] would always be a better candidate.

As a result elements in the deque are ordered in both sequence in array and their value. At each step the head of the deque is the max
element in [i-(k-1),i].

Another discussion link is here.

Keep indexes of good candidates in deque d. The indexes in d are from the current window, they're increasing, and their corresponding nums are decreasing. Then the first deque element is the index of the largest window value.

For each index i:

Pop (from the end) indexes of smaller elements (they'll be useless).
Append the current index.

Pop (from the front) the index i - k, if it's still in the deque (it falls out of the window).

If our window has reached size k, append the current window maximum to the output.

Follow up 


June 29, 2017
Work on a solution using SortedSet, C# code is here.

Tuesday, June 6, 2017

A recipe for interview

June 6, 2017

Read blogs written by Jocelyn. Here is one of blogs called "A recipe for an interview".

Introduction


It is such a great learning experience to understand how interview works. Julia always encourages herself to be a learner. Philippians 4: 6 - 8, do not be anxious on anything, guard your hearts and mind.

It is also a good idea to read very nice article and learn the recipe being an interviewer. Julia recently did some study about "Can mocking make difference?", she continued to study the topic. "Recipe for the interview" is very well written article to explain how to use behaviour questions to sort out the candidates.




Notes taken 


Question #1: You've been doing <X> for a while. About how much of <x> have you personally done?

Question #2: What does it mean to do <X> well?

Question #3: What do you personally do when you do <X>?

Question #4: Have you made any <X> mistakes? Pick one and tell me the story.

Question $5: How did you ultimately deal with the situation?
Question #6: Do you think you could have avoided the mistake?


Bad answer: any of the neutral answers as their primary focus. Coming up with an opinion on the spot rather than having thought about it before.


Bad answer:
Never thought of improving their process as a result of the mistake. Thinking about it for the first time in the interview with you. The
change they come up with doesn't give you confidence it would prevent future mistakes.


Remember: do NOT feed then the answer to this question. Establishing up front what they think matters is critical to assessing answer quality in later questions in the series.

Pluralsight: Design pattern library

June 6, 2017

Plan to take course, 15 hours 38 minutes.

Study 30 minutes a time.


pluralsight: Algorithm and data structure II

June 6, 2017

Plan to take the course, 2 hours 30 minutes.


pluralsight: Algorithm and data structure I

June 6, 2017

Plan to take course on pluralsight.com.


pluralsight: Common writing mistakes

June 6, 2017

Plan to spend hours on the course - common writing mistakes.


Sunday, June 4, 2017

Elements of programming interviews

June 4, 2017

Introduction


Advised by the blog written by John Washam, Julia plans to read the book.

Several facts are considered.

1. The book is written using C++.  Julia writes programming using C#, but she likes to learn C++ in the same time.

2. Read the book, and then work on each algorithm in the book, practice related algorithm on Leetcode.

3. The algorithm "median of stream" in the book "Code interviews" by Harry He is excellent. Julia read the book two years ago, but this time she will practice the algorithm. Now Julia is an active learner. She tries things as well, she knows that programming is a crafting business, you have to write your own, have your own style.

Book reading 


Elements of programming interviews, authored by Adna Aziz, Tsung-Hsien Lee, Amit Prakash, 60 pages written in 2012. 

Saturday, June 3, 2017

Elina Svitolina - Learn from a tennis player a time

June 3, 2017

Introduction



It is the great experience to start mocking experience after March, 2016.

One thing Julia like last 2 months is like having one to one study group. She was able to meet fifty people and suddenly she started to learn the algorithm through failure and success. Fifty people in the world helped her experience how hard the peer can work on the algorithm, or get stuck and need help; Julia learns a few things from one simple algorithm and data structure from different peers. She got a few of advises to help communication, she started to correct herself, like speaking slowly. She got some tip from one peer how to analyze time complexity better, another peer how to write white board testing, another peer how to be a systematic problem solver vs being a hacker; a few of peers shared with her their onsite experience and what are the most important.

Classified those 50 mocking experience into 3 rounds, first round she concerned about how to solve the problems, and then second round she started to notice the detail and the optimal solution she missed. Now she started third round, she found out that 30 minutes should be more conversational, add test cases before problem solving is most important and she should start to practice it.

Related to tennis sports, Julia likes to set a goal for mocking. Build a good ritual to structure her 30 minutes. Add test cases setup in first 10 minutes, speak slowly, get rid of anxiety in mocking.

Julia also likes to spend time to learn from one tennis player a time, not just focus on those top 10 players, or players she likes most. Tonight she likes to spend 20 minutes to study a tennis player, how she made great success in her career. It is a short time to do the research, and see how far she can go.

Tennis player study 


13 minutes interview of Elina Svitolina - the video link is here.

WTA Can challenge 


It is the fast way for Julia to train herself to get to know more WTA players in less than 15 minutes.

Here are videos links. First one is here, less than 2 minutes.



Leetcode weekly contest 35

June 3, 2017

Introduction


It is a good practice to work on a contest this Saturday starting from 6:30 pm. Julia likes to play contest more often therefore she can figure out tips to be a great player.

Contest performance talk 



The first algorithm is called "Can Place Flowers". It took Julia almost 50 minutes to pass the online judge. First Julia tried to use recursive function and then she figured out it was too much work after 20 minutes. And then she chose to use iterative solution, but it took her another 20 minutes to fix bugs in her writing.

The second algorithm is called "Construct string from binary tree". It took Julia only 20 minutes to write the solution and she passed the online judge.

The third algorithm is called "Find Duplicate File in System", Julia only had 20 minutes, she wrote the code but she could not finish in 20 minutes. After the contest, she just wrote another 5 minutes, she could not believe that the code was easy to work on as well.

So the performance of her third weekly contest is here.



Plan to work on hard algorithm in the contest called "Tag validator".

Leetcode 591: Tag Validator

June 3, 2017

Problem statement is here. The difficulty is hard level.

Julia likes to work on the hard algorithm and plan to spend 30 minutes to work on it first.




Leetcode 606: Construct String From Binary Tree

June 3, 2017

Problem statement is here.

Julia's C# practice is here.


Leetcode 605: Can Place Flowers

June 3, 2017

Problem statement is here.

Julia's C# practice is here.

Why it took 48 minutes?


It is a good idea to review the process to get the correct solution, after a few submissions. Through the contest, Julia spent time to play with online judge, she submitted code more than 3 times, failed to pass the test case before submission. She failed twice with two submissions. 

Here are the code with highlights of bugs Julia spent more time she could afford in the contest. To improve her performance, she should aim to complete the easy algorithm in 10 minutes instead of 48 minutes. 



Preparation is the key


It takes a lot of discipline and hard work to be more efficient to write an easy algorithm. Julia likes to set a goal to set 10 minutes for an easy algorithm.

The idea is to go over 4 places she highlighted her mistakes in the first writing. How she introduced the bugs in her analysis.

What are missing to help her to develop the correct code?

She will study a little more and figure out what to make her coding speed up. Learn to use white boarding test, do not back and forth using online judge to correct logic thinking flaws.

Julia likes to change her style in coding. Do not rely on online judge, write a bug-free code using white boarding testing. But she should have done it early and then she starts to build up experience.

It is a good idea to set up a few test cases for the algorithm. Do not rely on the test cases behind the Leetcode online judge.

Spend at least 5 minutes in the contest to set up a few of test cases, and also calculate the answer. Use those test cases to help the design, understand the problem first.

1 0 0 0 0 1 => answer to plant flower is 1 => 1 0 1 0 0 1
0 0 0 0 1    => answer to plant flower is 2 => 1 0 1 0 1
1 0 0 0 0    => answer to plant flower is 2 => 1 0 1 0 1

1 0 0 1 0 0 0 1 => answer to plant flower is 1 => 1 0 0 1 0 1 0 1


Study the discussion



Choose the idea in the discussion - here is the link. 

C# code is here. 

Unbelievable clear and short code. It only takes 5 minutes to complete the code.

 

Leetcode 609 - Find Duplicate File in System

June 3, 2017

Problem statement is here.

Julia's C# practice is here.


Coaching talk from tennis grand slam French Open 2017

June 3, 2017

It is so interesting to learn from French open and how Novak hired Agassi, and how Agassi took the most challenging job and how he adapted the new role with great attitude.

This is really fun to watch a few of videos.

1. 4 minutes talk between two coaches - video is here.

Talk - Agassi's insights 


Coaching is the first to learn how he thinks himself. I want to understand him thinking about the other side of court. And I will be very careful not to screw him.

We will figure this out when he really needs.

2. 3 minutes video - McEnroe & Becker about Agassi & Djokovic - RG 2017
video link is here.

3. 2 minutes video - The Coach: How Halep overcomes her lack of power. The video link is here.

4. 2 minutes video - Djokovic reveals Agassi inspiration Roland Garros 2017. The link is here.

A success story by John Washam

June 3, 2017

Introduction


Plan to read the blog written by a new Amazonian John Washam.

Julia practiced mocking experience at 10:00 am. It is such a great experience for Julia to learn how a first year student in university of Bath, ranking top 5 in United Kingdom, quickly learned Binary Search Tree (BST) and solved the problem almost perfect in 30 minutes. Julia had chance to watch and learn how the peer to master the binary search tree through problem solving.

Quiet interesting experience, Julia learned that the great learner is also a very calm and also speak slowly.

It is called introvert personality. Julia likes to learn from this personality. Learn to talk slowly, listen quickly.

In the end,  she was given a tip to read this github, most viewed called "Google interview university".

Blogs 


Blogs chosen to read one a time.

learning phase - link is here.

Retaining computer science knowledge - link is here.

I have been acquired by Amazon - link is here.

Context switch in my coding interview study plan - link is here.






Friday, June 2, 2017

Leetcode weekly contest practice

June 2, 2017

Plan to spend early morning hours to work on leetcode weekly contest. Therefore, Julia can build more strong interest in the algorithm learning and stay focus on the learning.

Plan to spend 8:00 am - 10:00 am to play one of expired leetcode weekly contest.


Thursday, June 1, 2017

Leetcode 230: Kth Smallest Element in a BST

June 1, 2017

Plan to work on the problem called "Kth Smallest Element in a BST". The problem statement link is here.

Plan to study the algorithm "Second largest element in BST". The link is here.

Introduction


One of most common algorithms is to find the largest value in a set. To solve the problem, Julia has to learn to step back, to find a value in the set first, and then compare to existing largest value when a new value is found.

Julia learned the lesson through the mock experience. The algorithm is to find largest smaller value than the given value in Binary Search Tree (BST). In other words, any number in the BST less than the given value can be added to the set, and the task is to find the maximum value.

The lesson learned is to find a smaller value first, and then save it as maximum value; continue to search and continue to compare with existing max value.

Algorithm study 



Refdash Demystifing Interviews - Dynamic programming

June 1, 2017

Watched the video 90 minutes called "Demystifing Interviews - Dynamic programming". The video link is here.

It is such a great talk about the algorithm, the link of the algorithm is here.


Leetcode 40: Combination Sum II

June 1, 2017

Julia's C# practice using recursive, backtracking is here.

First practice, failed to pass a test case, the code is here.

Using dynamic programming, Julia's practice code is here.


Leetcode algorithm practice 



It is a new topic, short research Julia likes to find some good ideas.

How to compete those contest lasted just around one hour? Julia starts to learn how to work on Leetcode algorithms more often.


Leetcode 39: Combination Sum

June 1, 2017

Julia's C# practice is here.