Tuesday, June 13, 2017

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.

Wednesday, May 31, 2017

Leetcode 416: Partition equal subset sum

May 31, 2017


Study leetcode 416: partition equal subset sum. The problem link is here.

Amazonian - USC alumni - Xie Tao - Leetcode profile is here.

Study the solution:
Java dynamic programming solution is here.

Julia's C# first practice is here. 


Leetcode 295 Median of stream

May 31, 2017

Leetcode 295. Find median from data stream - discussion panel is here.

C# solution using SortedSet. The C# code to study is here.

C# solution using MinHeap/ MaxHeap - self defined. The study code is here.

Read blog about the discussion again - link is here - the blog on ardendertat.com

Question 69: Median of a stream (Julia's ranking:  10 out of 10  March 31, 2017), book: Code interviews, Harry He. 

Follow up 


June 6, 2017

Julia C# practice using SortedSet, the code is here. 

Julia C# practice using self-defined Heap, the code is here. 

June 29, 2017
Review SortedSet implementation, the code is here. 

Actionable Items

Google search "SortedSet C# example leetcode", work on related algorithm, try to get more practice on SortedSet. 





Tuesday, May 30, 2017

Leetcode 69. Sqrt(x)

May 30, 2017

Plan to review Leetcode 69. Sqrt(x).

Past practice

69 sqrt(x)

Blogs to study, yocoding blog is here. 


codganker blog is here.


C# implementation:

Leetcode 69 C# practice is here. 


Mocking practice

May 3, practice is here. 
May 30, C# practice is here. Root a number by power of n, for example, 0.001 - n = 3, root number is 0.1. 
June 26, C# practice is here. 

Julia did white boarding test on her own code, and then she found a bug on line 29 on test case 0.001, n = 3, search value 0.1. Learn to test your own code very carefully, and then find a bug on line 29. But Julia missed the bug on line 74. The peer asked the question to point out the bug on line 75, return integerValue/ 1000.0; not integerValue/ 1.0.

Pluralsight: Preparing for a job interview

May 30, 2017

Plan to spend 2 hours to study the course. Julia is doing a research for fun, her research topic is how to be a professional interviewer.

John Sonmez - linkin profile is here.

Algorithm based questions - 34 minutes


How to be a professional algorithm interviewer?

May 30, 2017

Introduction


It is a natural question to ask yourself how to be a professional algorithm and data structure interviewer/ interviewee. After practicing mocking more than 40 times, Julia starts to think about this small research topic. This is the first time she experienced so many mocking experience, and then she asks herself what is motivation to continue, what she learns, what surprises her, what she likes most.

Julia has the chance to know the company refdash and also experienced once how a professional interviewer perform the mocking experience. A professional algorithm interviewer will meet over 1000 people through mocking experience in less than one year.

A small research 


The research topic is for fun and also bring into some good thoughts later. 

Google and find one article about what Google to look for: 

"We are not simply looking for engineers to solve the problems they already know the answers to; we are interested in engineers who can work out the answers to questions they had not come across before." 

Interviewers will be looking at the approach to questions as much as the answer: 
* Does the candidate listen carefully and comprehend the question? 
* Are the correct questions asked before proceeding? (important!) 
* Is brute force used to solve a problem? (not good!) 
* Are things assumed without first checking? (not good!) 
* Are hints heard and heeded? 
* Is the candidate slow to comprehend / solve problems? (not good!) 
* Does the candidate enjoy finding multiple solutions before choosing the best one? 
* Are new ideas and methods of tackling a problem sought? 
* Is the candidate inventive and flexible in their solutions and open to new ideas? 
* Can questioning move up to more complex problem solving? 

Google is keen to see really high quality, efficient, clear code without typing mistakes. Because all engineers (at every level) collaborate throughout the Google code base, with an efficient code review process, it’s essential that every engineer works at the same high standard.

Things to learn:

1. Take mocking notes - time, what question ask/ being asked?
2. Prepare hints
3. Learn to have a quick code review - find bugs, sort priorities
4. Learn to rate the peer using 1 - 4, understand 2.5 passing bar.
5. Know 3 things to interview, knowledge, analysis, execution.

Advice:
A - Ask correct questions
C - Comprehend the problem
L - Listen carefully
M - Find multiple solution, choose optimal one
O - open to new idea, inventive and flexible
U - move up to more complex algorithm

Study Refdash/ Interview Kickstart


1. UVA career center - article is here.
2. Havard junior talked about interview and how to structure the interview. The article is here.

  • Repeat the question to make sure that you understand it and have all the relevant details.
  • Clarify the function input and output.
  • Check assumptions.
  • Give an approach to solving the problem.
  • Discuss the tradeoffs of the approach.
  • Code the solution.
  • Test the solution with a normal test case.
  • Test the solution with some edge cases.
3. Fast company article about interview platform - article is here. 

4. Quora question - the link is here. 

5. Interview Kickstart - quora link is here. 

June 6, 2017

Hiring Series - blogs written by jocelyn goldfein. Link is here. 

Monday, May 29, 2017

Second silver medal on hackerrank

May 29, 2017

Introduction



It is a nice and long journey for Julia to win a silver medal on world codesprint 11. Julia spent over hours to work on first 5 algorithms and she enjoyed the contest. Now it is 11:20 pm, Julia chose her tonight study topic is about "How to play smart on Hackerrank contest?". She did one study on a top player who scored 189, almost double score Julia made (90), also the player won a silver medal.

Here are some facts:

1. Need more hours to work on the expert level algorithms
2. Do not plan very well. Instead of staying up to 3 am, Julia should go to bed early and work from 6 am - 9 am. Early morning hours is blessing used for work.

Bible verse shares the secret to get up early and work hard.

Read the article "6 Reasons Why Staying Up Late Can Be Toxic for Your Health", things to consider with negative influence: bad eating habits, not enough sleep, immune system to get weak, melatonin production can be affected, prone to negative thoughts & anxiety, risk for sleep disorders, a bad habit & insomnia.

3. Need to work on long term, work on expert level algorithm. Take 30 minutes a time for each expert level algorithm. Take some risk not to score anything.


Silver medal talk 





Clean code: Writing code for Humans

May 29, 2017

Study the code on pluralsight.com. The course is called "Clean code: Writing code for Humans".

Read the article on pluralsight.com. "7 reasons clean code matters" article is here to read.

Take some notes here.

11:13 pm, 5/29/2017

The course is released on Oct. 7, 2013. It is always on time!

Julia, it is always better to learn coding styles, principles first and then practice leetcode algorithms.


Cory House   - the lecturer of the course's website is here.


assign booleans implicitly (Julia's favorite rating: 7 out of 10)

- 3 good reasons to create a function (10 out of 10)

convey intent, eliminate excessive indentation, avoid duplication

problem with zombie code



Boundaries matter - (Julia's rating: 9 out of 10)

dynamic JS in C# (JavaScript and C# etc),
html in JS string,
JS in HTML (JavaScript and Html),
inline Styles (css and html),
Dynamic SQL in C# strings


Stay native - advantages (Julia's favorite ranking 9 out of 10)
1. Cached
2. Code colored
3. Syntax checked
4. Separation of concerns
5. Reusable
6. Avoids string parsing
7. Can minify & obfuscate

Maximize signal to noise ratio (Excellent concept!)

Signal
Logic that follows the TED rules:

Terse
Expressive
Do one thing

Noise

High cyclomatic complexity
Excessive indentation
zombie code
unnecessary comments
poorly named structures
huge classes
long methods
repetition
no white space
overly verbose


Self-documenting code

Well written code is self-documenting.

Clear intent
Layers of abstractions
Format for readability
Favor code over comments

Complex conditionals


Discussion topic - excessive indentation: solutions

extract method
fail fast
return early

Mayfly variable - just in time

Continue


June 5, 2017  11:00 pm - 11:53 pm

Demo 42 minutes

Bug Fix: What a contrast (Julia's rating: 10 out of 10)

Terse
Expressive
Do One Thing

Watch the lecture titled "Clean Code"

Follow up 


July 29, 2017  10:30 pm - 11:30 pm
Go over the lecture video again

TED Principle
Terse, expressive, do one thing
Don't repeat yourself

How to write Self-document code?
clear intent
layers of abstraction




Leetcode 18: 4 sum

May 29, 2017

Problem statement: the link is here.

C# practice is here.

Alternative practice


Find a 4 numbers in the array given the sum value.

Here is the practice transcript. The link is here.

Rookie in recursive function design

May 29, 2017

Introduction


It is the great experience to teach myself how to write a correct recursive function to implement a depth first search algorithm. Julia spent over hours to teach herself, how to track a route in depth first search over one hour.

In order to figure out the issue, Julia wrote a depth first search algorithm using stack to help herself. She compared to the version using stack to the one using recursive function. She found out that the issue she had, she did not need to use memoization, she needed a memo to mark visited node to avoid dead loop.

Code practice 



C# code with dead loop, stack overflow issue. Mocking code is here. 

C# code to write a stack to implement Depth First Search (DFS). Code is here. 

C# code to write a recursive function. Code is here. 

A cheerful heart is medicine. Smile to my own mistake, next time I will ace the recursive function. Coding is done by a human, crafting takes practice!

Recursive - HARD TO TELL


Argument:

Use non-recursive depth first search algorithm to help the design. Using an explicit stack, it is much easy to follow. Write pseudo code, figure out base case, the design to avoid dead loop, cycle issue, memoization issue, structure the algorithm first. And then use it as the helper of recursive function design.

Recursive function is short and efficient to implement DFS, but error-prone. It is not straightforward. Practice this way to help yourself.


Use stack to help


Every mistake is valuable


I should say that memoization is extra, next step. Need to work on basic recursive function boundary check first. One thing is to test the code with the sample test cases, slowly and carefully, mark the test case for each line of code using comment.

To be a good tester all the time. Read your own code and go over it, with test cases. Julia, you got the tip from mocking experience.




Sunday, May 28, 2017

Numeric string - world codesprint 11

May 28, 2017

Problem statement is here.

Code submission in the contest is here, score full score 30 points.

Saturday, May 27, 2017

The best mask - world codesprint 11

May 27, 2017

Introduction


Problem statement is here.

It is 9:30 pm, Julia worked on the algorithm starting from 7:00 pm, and then after 2 hours 30 minutes, she finally made some progress. Here is the report:


Good food, a blog, one hour nap, 


As a hackerrank player, Julia got home 3:00 pm, she spent 45 minutes to write a blog about mocking experience to entertain herself first; She took a nap from 5:00 - 6:00 because she felt tired after working on algorithm "city construction"; She entertained herself with a friend with dinner, and talked about her mocking experience and hackerrank contest.

Julia tried to bring herself to a zone before she starts to code again. And then she studied more about "city construction" medium algorithm. She knew that she should be able to write something for the algorithm before 12:00 pm.


Compare to a peer


One thing Julia likes to do is to check ranking by country: Canada. She likes to compare one of top players, and here is the comparison. The time is running out, Julia like to choose some algorithms to work on in next 3 - 4 hours.

Understand hard level



Gave up at 10:37pm. Try to give at least 2 hours to solve "city construction". The algorithm is asking number of ones in the binary expression of x is minimum. Julia worked on the problem like "number in the binary expression of x is minimum".

Julia tried the idea to solve the problem, but her solution scored 11 points. She gave up the effort and will work on it after the contest.

Follow up 


May 28, 2017  1:44 pm
After the contest, post the code submitted in the contest. Score 31 out of maximum score 75. Will look into the correct solution later.

A cheerful heart is good medicine

May 27, 2017

Introduction 


Proverbs 17:22, Julia's favorite verse. "A cheerful heart is good medicine, but a crushed spirit dries up the bones". Every time Julia is too busy to work on something, she starts to check whether she has the feeling of a cheerful heart, specially she likes to stay late past midnight to work on a contest algorithm. She likes to share a story of a cheerful heart, and ends her weekend with some good story.

The mock experience is related to people skills and Julia started to learn how to make most from it. She has limited resource and limited budget to try new things. She chose free mock experience, she never tried any paid mock experience, but she did feel that she has to make mock experience very good learning activities.

Always have a cheerful heart on your own or peer's mistakes, they are the best friends of algorithm problem solvers. Coding is a crafting skills, talk about mistakes, journal the transcript, and then get back to compete again.

4 Sum


People with top talent to attend mock usually are very young and just start his/ her career, and one time Julia felt that the hints were too strong in the first 5 minutes, she had to take the hint given by peer. The algorithm is 4 sum, Leetcode 18. Second time she was mocked again using similar algorithm like 4 sum, she decided to work on practice Leetcode 4 sum. Here is her practice C# code. Her second mock code is here.

Edit Distance


Julia learned so many lessons from her own mistakes. She could not figure out dynamic programming Edit Distance in her first round mock in 2017. Overall, she almost failed at least 20% - 30% in her first round.

Julia wrote a bug on spiral matrix first as an interviewee, and then she interviewed some one the spiral matrix. She observed carefully the peer's performance, she had more confident to make the code perfect later on.

Every peer get stumbles in mock experience, she reminds herself not long ago she had same experience. Julia felt so connected through mock experience.

She suddenly found out that she never met and talked to so many engineers in the world, but she did in one weekend. As a programmer, she felt a little proud of learning to review peer's code and also recommend a book "The Art of Readable Code".

Last long weekend, she managed to finish 11 mock experience. So she almost finished her second round. The fact is that second round is learning round. Test your own code, not using compiler, use your own whiteboard techniques.

Reverse string 


The fact is that she met strong peers who shared her importance to learn and write good clean code, specially recursive, DFS, and also the peer still practices. The meeting is short but she feels that the study group formed through the discussion is also very rewarding experience, she would be a nice algorithm teacher one day if she continues.

It is fun to play with a peer. One day, Julia  met a peer again and she was too busy to follow the peer's idea to solve the problem, but she knew that the peer was working hard and the idea needs to be tuned. Julia likes to gain some skills to be a professional interviewer one day, so she learned quickly to say sorry, not followed closely with the ideas in the code. Good heart leads to a new world, the peer told her that there is something new and different, she was well received with a tip.

"Every player knows how to play tennis". That is the famous tennis professional player's quote. Only those survive with strong mind set, and determination, and the hard work training, practice.

Related to tennis sports, Julia learns to treat peers equally and be supportive in mock experiences.

Julia missed how a professional mock experience will look like. She booked one mock and surprisingly she got one in less than one week.

Study and talk 


Julia wrote a blog about the study "Does mock make difference", and then she moved herself to next stage in her practice, know a professional interviewer with thousand experience, and also learn to mark herself with a mark, May 27, 2017, she got a mark which is called passing the bar - 2.5. 

Good heart leads to a new world. Julia likes to show people that she has determination to gain skills in algorithm and data structure, and is working hard on the improvement. Still exploring...

Julia understood that those contest practice with medium levels are very helpful, she prepared herself, she felt that the depth first search, recursive function call is so important to learn.

She forgets to write a base case in DFS algorithm, still she needs to the hint to go over the test case and then find out that she lets the loop forever because of that.

City Construction - world codesprint 11

May 27, 2017

Introduction


Now it is 3:08pm, 18 hours left for the contest. Julia was busy this morning. She had her first mocking experience with a new company called refdash.com. She could not believe that after 40 mocking experience, she started to enjoy solving algorithm and data structure problems and survived first algorithm.

After 10:00 am - 11:30 am mocking experience, she went back to the .NET user group and had a lunch, attended one hour session for a talk. She quit early because she likes to get some learning experience through those four algorithms. One medium level, one hard level, two expert levels algorithms in world codesprint 11.

Julia likes to play contest and she just could not believe that she could not take whole afternoon to sit in lectures. She likes to play competition, and get challenged on algorithms. Julia is an active learner, she likes to try new things, build something using her crafting skills, specially algorithm problems.

Coding in the contest 


Code from 10:00 pm to 3:00 am, score 0 even though the algorithm passed a few of test cases Julia set up, also sample test case. Great learning opportunity after the contest. 

Here is the progress report. 


Follow up after the contest


May 28, 2017 1:38 pm
Code submitted in the contest is here. Score 0. Will find out why test case 1 fails, there are 10,000 roads. Timeout is the issue.

The union find algorithm is the classical algorithm, which can be applied to this "City construction" algorithm. 

Friday, May 26, 2017

Simple File Commands - world codesprint 11

May 26, 2017

Introduction


It is 11:51 pm. Julia likes to check her progress of the contest. She likes to work on every algorithm, and take the chance to learn something, specially hard and expert level algorithms.



Status report 

Follow up after the contest


May 28, 2017
Code submitted in the contest is here, score 20 out of maximum score 40. 

Thursday, May 25, 2017

Data Structures & Algorithms with JavaScript - Michael McMillan

May 25, 2017

Introduction


It is the best time of the year to learn JavaScript. Julia chooses to read the book and learn more about JavaScript. She likes to think problem solving using JavaScript in the future, so it is better to start to build hours to practice, read the book 30 minutes a time.

Book reading