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.






Janko NEXT Generation Tour

April 8, 2017

Introduction


Aging is a great progress, Julia learns how to work with young generation. She also chose to study Janko - how he helped young generation player - a junior player ( 17 years old) to work on ranking 300 to ranking top 100 ATP players. Janko was top 10 player when he gave out his advice to practice with young player, back to 2012.

Video is here. Episode 1.
Episode 2.
Episode 3.
Episode 4.

On The Road to the ATP World Tour Ep. 1

Tie-Break 2/ 5 - coach talk to junior

ATP World Tour uncovered Janko Tipsarevic.

Open court with Janko Tipsarevic


Study how to coach as tennis pro Janko 


Entertainment video


Who has which tattoo?

H tree - a talk about training

April 8, 2017

H-tree is constructed by layers, next layer will start from four corners of H as centers, and the size will be smaller one.

Problem statement - Read this Java implementation from princinton.edu - H-Tree

Introduction


Julia started to study mocking interview, and see how many things she should work on. Instead of writing a simple recursion version, Julia chose to write a BFS solution using queue. It is a good practice and also showed her passion to write a solution and learned from her mistakes on the mocking.

Training review 


Here is the C# code she wrote in mocking 30 minutes.

Spent over one hour to make the C# code bug-free and code readable.
Also, line 83, correct the calculation of length using square root 2. C# code is here.
Again, make variable names shortest, line 90 - 95. C# code is here.
Things learned in the mocking experience:

1. Julia thought out loud using queue to implement the solution, the interviewer gave out hints to use stack, depth first search;

2. Julia thought about using stack but forgot about recursive function is a natural stack; in other words, using simple recursive function call.

BFS/ DFS difference - DFS can use recursive call, internal stack.

3. Using Queue will work, but the depth should be pushed with queue with center node's information.

4. It is important to stay calm, write instructional code.

Highlight of good/ bad things in mocking experience
(the C# code in mocking experience, good thing is highlighted using brown color, bugs and mistakes are in yellow color):

0. line 1 - 12 work on a H-tree understanding, write a small test case. Understand the H-Tree draw lines, and also requirement of starting length and depth.
1. line 18 - 27, write an internal class Node, define two variables, node and depth.
2. line 22 - 26, Write public constructor of Node class to set up a new node
3.  line 30, Function name is very good - DrawHTreeToDepthUsingBFS
4.  line 30, Function DrawHTreeToDepthUsingBFS's design flaw - return argument should be IList<Node>, not IList<Tuple<int,int>>, missing depth information. Depth information is needed to calculate length of H-Tree.
5. line 29, time complexity is correct? Need to write a recurrence formula first, and then time complexity.
6. line 34 - 37, depth <= 0 will be better
6B. line 39 - syntax error - duplicate new Node(
7. line 41 - Enqueue method - input argument should be variable - node
8. line 43 - adjustLength = depth;  should be adjustLength = startLength, mix length and depth two variables
9. line 57 - 64, should add checking of depth, add H-tree is conditional - major issue
10. line 57 - 60, 4 corners of H, new center node's x, y values are not correct.


Julia, you have to learn from tennis training coach - Janko Tipsarevic - train yourself to be able to write a bug-free, very instructional code. When in real matches, a lot of emotions are mixed with pressures, will to win, anxiety and pressure, you will not notice those mistakes and errors.

Next time, try to write much more slowly, make sure that every line of code is bug-free, syntax ok, no duplicate code.

Through this mocking experience, Julia learned that she still had to practice more on BFS algorithm using Queue, Julia was very comfortable to write and understood that either BFS/ DFS will work out with no problem.

Julia did not have time to go over the code because the peer did not want to wait after 30 minutes.

Also, Julia did not come out using recursive function to write, even after hints. Julia was nervous because she asked help to understand H-Tree with the test case.

Julia likes to show her rigor training through asking over 30 algorithm questions she got from codereview.stackexchange.com code reviews last 6 months, she is able to write perfect and most modern C# code.

Actionable Items


1. Learn to interview people with different background, technical strength; Learn to write down notes and give out good advice.

2. Do not book more than one mocking a time.

3. Try to improve score of problem solving skills, ratings are low 3 of 7.

4. Take it slow, write instructional code, avoid duplicate code. Using meaningful variable name, function name.


5. Go through up-and-downs through mocking experience, learn to appreciate the time of peer. Try to
manage better the 30 minutes time. Avoid lengthy discussion, be very diplomatic, writing is most important part to show good skills and analysis.

6. Work on a small test case first, this part is very good warmup and prevent bugs in writing and design correctly first time.

7. Make the mocking experience more structured, write down a small test case to understand the problem, show some analysis, and talk about design and choices I may have.

8. All issues Julia had on real experience are reproduced in this mocking experience. Julia, practice more. Do not give up. Write down your feelings, and issues. You will sort it out later.

Follow up 


June 19, 2017 mocking third time. Very short and clean, using recursive function, using meaningful name. C# practice is here.

Friday, April 7, 2017

Leetcode 40: Combination Sum II

April 7, 2017

Problem statement

Log of brainstorm time:

4/7/2017  9:30 pm - 9:40 pm



Leetcode 39: Combination Sum

April 7, 2017

Introduction


Problem statement

Julia found out that the discussion on Leetcode algorithm generates more than 11.9k views. She decided to study the algorithm again.

Log of study algorithm:

April 7, 2017  9:15 pm - 9:25 pm




Walk through a small test case - median study

April 7, 2017


Problem statement: 


Add 1, 2, 3, 4, 5, and then keep tracking medium value to make sure that it is accessible using time complexity O(1).


Introduction


Julia teaches herself how to analyse step by step and get into the design of data structure this March 2017. First try, her thought thinking process looks naive from this blog but she likes to write down thought process, and continue to work on it. Life is much easy if Julia chooses to start baby step, reexamine things involved, small talks about every concept which should have been considered in the design process.

Julia likes to spend time on a test case rather than thinking about so many ideas/ articles/ practice she had worked on related to search median algorithm, that is a game to test memory. Instead Julia likes to show a better way, from her training of mathematics courses through her universities - SJTU, FAU math and computer science department, nothing can beat a small example and powerful message of problem solving, it is simple process but it brings out a good thought thinking process - maybe showing great mindset. Time is well-spent on the small test case. 

Baby step talk about data structure design 


Julia likes to practice this to get her familiar with heap concepts and also max heap and min heap.

Here we go.

First 1 is coming, put 1 into left side data structure, she is not sure what kind of data structure should be. 

The median is 1, no problem, just to get the first and only number in left side. 
Left side           Right side
1

And then, 2 is coming, Julia likes to put Right side.

Left side    Right side
1              2

Median is (1 + 2)/ 2 = 1.5

Now, 3 is coming, we have to decide 3 goes to which side, why? 

Binary search tree vs binary tree


1 2 3, 2 is the medium, we like to keep 2 at the top of data structure, first we decide to let 3 join which side, left or right? 

To allow first number 1 goes to left side, max heap is used for left side data structure. And there is implicit rule, left side data structure saves left half of the numbers, smaller one.

Repeat, middle element is the root of tree, no need to sort, binary tree, smaller half of numbers is in left side data structure. We can make it a max heap.

Rule 1: Left side data structure saves left half of the numbers - smaller ones


Because it is there is no need to sort everything which costs unnecessary time, using binary tree instead of binary search tree, to make median calculation be O(1), we like to keep the middle element at the root of binary tree. 

Left side - Max heap 


So, 1 is smallest value, go to left side, left data structure uses max heap. 
Left – 1
Right -   2

Right side - Min Heap

  
3, right side is min heap.

Extra rule - left size always not smaller than right side


Keep the left side’s size >= right side

Adjustment - heapify


Move 2 from right side to left side
Left side:  2 1   (starting from root node, and then level by level)

Using array to represent a heap


complete binary tree, 1 2 => node's value is smaller than child's value, swap => 2 1

Right side:  3
The median is 2, since left side’s nodes > right side’s node + 1

Next 4 is coming,  put 4 to right side

Left  side:  2  1
Right side: 3  4

The median is (2 + 3)/ 2 

Next 5 is coming, put 5 to right side because 5 is bigger than left side data structure - max heap's max value. 

Left side:   2  1
Right side: 3  4  5 

And then move 3 to left side:

Left side:
   2                   3
1   3     =>   1     2

Right side:
  5               4
4     =>    5

Actionable Item




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. 


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 mocking interview - systematic way 



A note of thankfulness


Julia likes to write a small note to thank Brooklyn to help her on writing better on this blog's introduction section, who is a graduate of linguistic major from university of Victoria in 2015. Brooklyn gave her comment about blog writing in general, and she said that Julia writes very well now. 


Study the theorectical computer science ranking board

April 7, 2017

Introduction


Julia is looking for some good ideas to help herself to learn algorithm analysis. She likes to find out what she can learn in her spare time; if she does not study Leetcode algorithms, she can read something little deeper to help her thinking about algorithm and data structure, not too advanced.


Study of ranking board


Study ranking board on computer theoretic site


Need to read something here:

Algorithm website of the professor Jeff Erickson

Algorithm lecture notes

Algorithms from the Book

92 answers, one of Julia's favorite about median of the list. 

Upenn professor Aaron Roth - algorithm research

True vocabulary app - by Ph.D. Shiva Kintali


Study one user a time

April 7, 2017

Introduction



Julia could not believe that she had chance to communicate with a most talent programmer in the world through mocking experience. Because Julia was interviewed first, she has no idea the peer's background. She observed how peek performance of mocking is, well structure and complete process. Brainstorming, coding, test case, etc. Every step is well performed.

Julia knew that she has to stay humble, if top performer can stand to mock interview her, she is better to serve others as well. She learns an algorithm through mocking experience. She needs to work on finding optimal solution in the first 10 minutes of time.

Julia likes to learn algorithm first, reading is a good choice.

Algorithms to study 


Today she plans to study one leetcode user: d40a.

Julia, work on those algorithms, think about each one for 10 minutes, and hold on to find out answer; come back later to think again. Schedule one week to think about those problems, sit it one week, and see if there is any new idea coming out.

Take your time and let yourself to figure out algorithms, even it is slow.

Having some algorithms in every day to think about, ....

What problems he worked on:

Leetcode 232 - basic calculator

Leetcode 337 - Missing Number

Leetcode 354 Peeking iterator

Leetcode 505 - mini parser

Leetcode 513 - Perfect rectangle

Read another top player's thought process:

Leetcode 389 - best time to buy and sell stock with cooldown

Pepsi's thought process about Leetcode 389

Actionable Items


Read 10 leetcode algorithms, try to understand the algorithm, think about a week. Do not look up discussion, come out your own ideas.


Study one user a time on leetcode

April 7, 2017

Julia starts to read more on leetcode.com. She plans to study one user a time. Today she chose to study Google software engineer - yavinci


Thursday, April 6, 2017

Short study about reaching plateau

April 6, 2017

Introduction


Julia chose a small topic to study every day. She did some study about reaching plateau. This year she will be on her job 7th year. She never did any job in her career before more than 7 years.

She has some interest to do study "reach plateau", can she keeping learning new algorithm? keep learning new things?

Study of reaching plateau 



Julia googled and read the article - Bob Sullivan: How Plateaus Prevent You From Career Success.

One of examples is Google ads director, old story back to 2012 

One character you’ll meet is Alberto Savoia, a Silicon Valley entrepreneur. Savoia has had successes and plateaus in his career, but what he learned is the value of failing quickly. He came up with the concept of “pretotyping” – creating barely functional mockups to test how a product or service would work hunt in the real world. Savoia went on to preside as the engineering director over AdWords, Google GOOG -0.43%’s wildly profitable advertising engine. He now helps other entrepreneurs “pretotype” their ideas to become tech standouts.

Julia chose this article to warmup her English vocabulary, learn some new words, and do some research on some arguments:

The book: The Plateau Effect: Getting from Stuck to Success

comfortable zones
the plateau effect
a force of nature as real and fundamental as gravity
sap life from us
grow numb quicker
gadgets
top out quickly - what is top out quickly?
peaking out - ?
plough ahead and change course
greedy algorithm - behave according to the algorithm - the best short-term solution, make instant progress
some of the world's most successful companies and people have been willing to make "retrograde progress" - to take a step back, "retrograde progress"
psychophysicists call the "just-noticeable difference"
setting clear, objective markers
the ability to fail fast
pretotyping


Leetcode 18: 4 sum

April 6, 2017

Introduction


Julia learned through the mocking experience of the algorithm. 4 sum algorithm optimal time can be lowered to O(N2), not O(N3), not brute force O(N4). Although it takes O(N2) space to build a hashtable to store all possible pair of two numbers in the array with the sum and two index of numbers, the algorithm actually beats O(N3).

It is Leetcode 18, Julia learned from the mocking experience. She did not follow the hints at the beginning, she wrote a 3 sum algorithm, which takes O(N2)time; but when she tried to put all possible 3 sum into hashtable, then time complexity will go up to O(N3).

A few things she learned from mocking experience:

1. Stay calm, write down everything slowly. There is a lot of time if it takes slow.
2. First 10 minutes it can be good brainstorm.
3. Try to find the optimal algorithm, take first 5 minutes to think about by yourself first, do not say anything until you are sure about the optimal solution
4. Keep the first 5 minutes private as long as you are not cheating, until you have to say something.

Values of the mocking experience 


Julia did not continue to practice mocking experience when she did not fully experience what she should work on. She stopped at the end of March 2016 with 8 mocking experiences. She guessed that she moved on to practice more on hackerrank coding online test.

The statistics shows that 15 mocking experience will be at least. It is not easy to get those 15 mocking experience. So far, Julia only had 2 times experience starting this April 1. She still has 5 mocking experience to go before she reaches 15.

She understood that she has to focus on problem solving, do not pay too much attention to the partner. But she needs to respond everything he/ she says.

Julia can write better maintainable, readable and clean code compared to April 2016. She just needs to learn how to work with people face to face, through mocking interview experience, she has less emotions.

Problem solving rating 


Last 2 experience, in the problem solving category, first time she got rating 2 of 7, second one is 4 of 7. 4 of 7 is related to "working out a brute force solution". Even though the first two mock interviewers are totally different in technical skills, but one thing is common. Optimal solution is the king, need to do some study on space and time tradeoff. 

Time complexity is much more important to battle, using space to trade time complexity. Processing something first and save into memory, using as less as time as possible.

Mocking season 


She missed the first two months of practice from January to March. Usually this is the season a lot of high competitive players are practising mocking experience, Julia should have chance to meet a lot of good players and learn from the experience.

Algorithm

Statistics 


Problem solving skills - 4 out 7

Follow up 

May 29, 2017

1.  using HashSet to find unique numbers.
Leetcode 18 - 4 sum, C# practice is here.
2. Try not to use HashSet, and see if it is solvable.

Wednesday, April 5, 2017

Leetcode website and community

April 5, 2017

Introduction


Julia learned something from her mock interview yesterday. The interviewer shared his leetcode user id. So, Julia chose her study topic today - Leetcode website.

Julia likes to study what she can learn from mock interview. She likes to google it, and see there is a good topic on that.



Leetcode website 


Julia plans to read more leetcode discussion pages.

Here is the link of heap related posts search by tag - heap.


Study all tags - link is here.

Most reputable users - link is here.

Most popular - link is here.

Monday, April 3, 2017

Sports research: strength and conditioning coach

April 3, 2017


Introduction


Julia knows the difference of good health related to sticking to unprocessed food. Julia tried to eat unprocessed food as much as possible, and only eat her own processed fresh food and vegetable and little red meat. Therefore she shows her great strength to play long hours of tennis sports, her partners are amazed that she can play very well long time and her concentration levels are much better than others. 

She also started to study strength and conditioning coach - how top tennis players found coach Scott Byrnes is so helpful for their top performance. 

Try to look into something valuable to make Julia as a more happy and healthy person, physical strength definitely should be no. 1 important, as a software programmer, write on white board and move a mouse, that is a piece of cake. Tennis player runs for every ball called a sprint, Julia really enjoys the much more honestly. 

Study of a conditioning coach 


Fitness, coordination, strength, balance, speed, - scott byrnes - strength and conditioning coach
3 coordination - head and eye coordination
Prevent injury - structure in your training

conditioning training video

How a coach helped so many WTA top players to achieve success?

Code review: C# LINQ and string.Split do it yourself

April 3, 2017

Introduction

As an old saying in Ecclesisaster 3 - A time for everything, Julia likes to take 5 minutes to celebrate her 8k reached milestone. Show the visual stuff here:


Code Review


Julia spent 45 minutes to write an algorithm to scan the sentence without compiler, and then spent over one hour to make it run using Microsoft visual studio. And then, she asked a question on code review.

Here is the link of code review. She was so surprised to get excellent code review. Sky is the limit, she has to learn so many things through the code review.

She was busy to read those documents of interface and class in order to understand the code review and discussion, IEnumerable, StringComparer, StringSplitOptions, Regex.


Sunday, April 2, 2017

Learn one tennis player - Johanna Konta

April 2, 2017

Introduction


Julia enjoys the tennis professional player interview, and she learns by each player and enjoy talks. Today she chose to watch 9 minutes interview of Johanna Konta.

Tennis sport talk 


Julia played tennis over 5 hours last weekend.  She went to Burnaby tennis court twice, last Saturday she invited a friend on tennis court, show her how to play tennis  first time over one hour, both of them warmuped to throw tennis balls to each other together; Last Sunday, she made a new friend, she was invited to rally with, and she had good time to learn and experience partner's style of strokes.

All 5 hours sports activities brought her new mindset. She is more positive and open minded, she knows that she could lose 5 lbs to 10 lbs if she continues to work on the tennis in the weekdays.

Julia knows that weight control is always a good topic, and also sports, and also coding skills, algorithm and data structure. And also talk about mindset, get into zone, overcome the fear in sports matches etc.

The tennis sports season is coming. Julia will have more time to meet people and learn something new tactically in tennis. Julia likes to build a strong mindset. First time in 2017, a friend on tennis court asked her how is tennis in 2017, she notices that people may have plans already.

Plan, plan and plan. It takes hours to get her skills back on tennis court. She just could not believe that she could run so fast to catch a tennis ball, and also go for whole full long swing in her forehand.

Julia has to learn to choose good activities using her limited time.


Study the player - Johanna Konta


champion of Miami open tennis 2017

time, patience, determination

Too may tools/ maturity / life experience out of court/ hand-to-hand/ life style

Background, family driven, tennis driven

Keep going, 20, 21, until 25 years old, Konta got her first major champions, what to make it happen?

Read the article - Talk about her coach.

Tennis coach - Wim Fissette

Search algorithm small talk

April 2, 2017

Introduction


Julia likes to do some study about search algorithm, the search can be median value, min/ max value, in other words, no need to sort the array.

Graduated from applied mathematics major back to 1988 and worked on math graduate study from 1996 to 1997, Julia started to follow the theoretic computer science on stackexchange.com starting from March 2017, she likes to train herself and execute her analysis talent learned and trained in her mathematics study.

Design a data structure? not completed sorted, not a binary search tree, should be a binary tree. How to determine two trees or one tree? If there are two trees involved in algorithm, then one or two data structures?

After searching past experience using median, kth largest/ smallest element, max, min on this coding blog, Julia found this algorithm called Leetcode 295.

Leetcode 295 discussion to read, link is here.

Julia likes to be a good data structure designer one day.


Search Algorithm study 


Plan to work on computer theory, median algorithms.

Here are median algorithm questions to study.

An algorithm problem and a blog -

Algorithm for 'k'' most frequently occurring numbers

How good a computer professor can write a blog? What I should learn from the blog and author?

Search heap data structure - content is here to read.

Array implementation of dictionary data structure

Study of computer algorithm professionals 


Julia likes to find something to work on - find a good mentor on algorithm analysis; Always find experts first, and then take some time to read questions and answers on algorithms.


1. UC riverside algorithm professor

Neal, E. Young - professor profile

Algorithms courses taught

Read some answers, evaluate how much Julia can understand the theory part.

Answers on cstheory

2. Utah professor - Suresh Venkat

Algorithm study stages - teaching

Code practice: analysis of scan document

April 2, 2017

Introduction


Julia likes to practice using LINQ and also learn how to write a C# program. Scan a string and then parse string using delimiters and order by descending order of word's count.

Time complexity analysis: O(Nm), N is the string length, m is the delimiters' length.

Code study 


C# code is here.

Julia reinvented the wheel, write a string.Split(char[]) method. She enjoyed the practice.

Julia need to train herself on LINQ - write statement to query Dictionary and then sort by value using descending order.

Stackoverflow question on LINQ - query dictionary and then sort by value using descending order.

Edge case in SplitMethod()

Actionable Item


Do not stop coding review. Always Julia gets surprising result. Code review this one to celebrate the weekend of first April, 2017.