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.


4 minute coaching of tennis - Janko Tipsarevic

April 2, 2017

Introduction


Julia has to train herself under stress, how to perform algorithm and data structure design. So many emotions will come up, and she has difficulty to do things.

She found herself a coaching lesson - 3 minutes lesson, talking about training, how to stay focus.

Janko Tipsarevic showed his teaching talent - how to focus, work on coaching - forbidding 3 mistakes in a row in the practice.

Coaching video study


Video is here.

Sit on your butt - having a puff?

a mistake hitting to the net - 20 jumps followed.

It is forbidden 3 balls hitting in the net in a row in the forehand swing practice. That is all things you think about. What will happen in your match (1:28 - ) you have all these emotions like fear and anxiety, will to win and line inspect (?) is bad, shit court on the field, what you said last week, there is no light on the court, then you will not think about, (1:46), be aware that you missed. But, here, is forbidden to do it. You should not allow this happen again.

2:43 No matter what I do, only important thing to do is to hit the ball in highest position.

What will happen in the match? So many things in match, so many emotions come up. (2:01 - 3:41)

Actionable Item


Watch more videos from Janko about helping NEXT generation, junior player who had 50 tournaments experience.

Saturday, April 1, 2017

Five qualities small talk

April 1, 2017

Julia chose to do some study about Amazon web service leader Adam Bosworth tonight. She reads one article and then here is her notes.

What would you say to a group of young people looking to enter the tough job market? It doesn't matter what you know. It matters who you are. At the end of day, smart companies hire, promote, and reward employees who demonstrate five qualities:

1. Intelligence
2. Hard work and energy
3. Pragmatism
4. Excellent teamwork
5. The ability to constantly learn new skills and apply everything they've ever learned.

Hackerrank HourRank 19

April 2, 2017

Julia will play hackerrank hourrank 19, and the contest will start from 8:00am PDT to 9:00am PDT. She knows what she should work on in the contest.

Beautiful 
Morning 
Run 

Journey of one hour


Recover the Arrays - 8:00 am - 8:20 am


The hour is very fantastic experience. First 10 minutes to read the first algorithm - Recover the Arrays, and then I asked myself what is missing in the problem statement, Julia missed the statement:

the array's number of elements and then each of elements are followed.

Julia took 10 minutes to figure out this, Julia read the graph with highlighted font "5 2 1" - first char in 3 rows asking herself - what is meaning of the number?

Score 20

What are the Odds?


This is the nim game algorithm. Julia tried to recall the algorithm, she read the problem statement in 10 minutes but could not recall the nim game and current algorithm very well. She has to find how many options, and then she searched her coding blog - Nim, reviewed the algorithm and solution.

Time spent: 8:20 - 8:40 am

The game is modified and she started to read special move before starting a game of Nim.
She tried to think about problem, it should be simple to enumerate all possible selection, and each of them play nim game.

No coding. It is hard to recall the game and it takes time to read through the problem statement.

Maximum Tree Diameter 


Julia decided to give third algorithm some time, from 8:52 am to 9:00 am, she likes to read the problem statement. And she did come out the idea what the problem is.


Actionable Items


Julia checked the third algorithm, how many Google employees played, and then she understood the difference, she has to take life style of those players, if she wants to be a good player.


Beautiful morning run - Julia called this hour a beautiful morning run. She got some companions as well.

Read those minutes, cuiaoxiang even finished 12 minutes before the hour. The first full score was made in the first 31 minutes. Unbelievable!

Julia, you should better invest some time and make the algorithm/ data structure as your powerful weapon. So, it does not matter which job you go to, you will have a good time!

Julia was glad to know that she found her reading challenging through the first algorithm. 10 minutes, she finally understood the algorithm. Based on the experience, in hour rank, Julia will try to work on more to read algorithm problem statement, make sure that she can understand easy algorithm in first reading.

Sports warmup 



Julia's favorite warmup - Sharapova warmup with her coaches 4 minutes video

                                         Angelique Kerber - tennis ball warmup


Tennis Olympics - Andrea Petkovic, Angelique Kerber, Juergen Melzer and many more 4 minutes video.

Algorithm talk - my poor analysis breakdown

April 1, 2017

Introduction


Muscle memory or analysis? Julia learned a lesson and she likes to write down to help herself grow her career. My poor analysis breakdown is to show that Julia tried to control something she has no control, her analysis talent. She built up the talent through practice, but it needs tuned. She learned quickly to dismiss negative feeling and learned to reproduce the issues through mocking experience, later she can overcome the fear and get into zone.

Julia used to work on a lot of assignments for real analysis and abstract algebra, combinatorics course, introduction to cryptography; usually she learned some theorem first, and then try to apply those theorem on the real problems. Proving something is real fun and it takes a lot of discipline.

But mathematics talent is like muscle, you do not use it and then you lose it, based on the fact that "You build muscle, but it becomes fat if you do not maintain it, strength it with sports activity".  Julia likes to find some court to practice her thinking, get some training daily. Therefore, as a software programmer, she can approach hard algorithm carefully and then generate ideas to solve the problem.


Case study 


Will come back after a month to write down when spring season is over. Summer is here.

Hackerearth Easy' 17

April 1, 2017

Julia did not get prepared to attend the contest, she found out the email until last 60 minutes. and then she spent last 40 minutes to work on the contest, she only did one algorithm and read second algorithm. She missed the fun part of struggling and learning.

April Easy 17

Julia will start to build a good habit to attend the contest, 3 hours in Saturday.


Professional tennis player Ana Ivanovic

April 1, 2017

Introduction


Julia read over 100 tennis player wiki pages, a few things she checks every time, prize money and ranking in single and double. And also the player statistics like coaching, how many coaches. She studies players one by one, and then she understands the different styles, strengths, and physical advantage or disadvantage, stage of career.

Julia chooses to learn from a tennis player, formed No.1, retired professional player Ana Ivanovic. She did some study about Ana how she came back from top 50 in last few years in her career. Up and downs, and every player learns so much how to manage her own mind, emotion, and diet, and training.

Algorithm problem solving


Julia did not find her own good personality when to discuss algorithm with a real person, she was suffering big pain because of past experience. She was struggling to deal with mind (emotion of fear of losing) and started to learn how to get into zone issue. Every tennis professional player has to go through the training and understand the sports mental state training, specially top players. It is much fun to learn from the Ana's interview after reading the article.

Julia does not have coaches of her own, and she learns from tennis professional players and their coaches. And she tries to learn from Ana through her career up and downs.

As a matter of fact, no one can solve all the algorithms in the world. Julia should balance her life very well, focus on more how to analyze the problem and compare various ideas to get the optimal one, even pretend to work hard on a small test case in important time will lead to great ideas. For professional tennis players, it does not matter how ugly you play, or how beautiful you have a shot in the sports, at the end of day,  you want to win.

Same thing as algorithm discussion in person, you want to solve the problem, give optimal time/ space algorithm, and then you can score highest, just be yourself.

Last time Julia did not dismiss her nervous when she had to perform on a data structure analysis, so she decides to go back to practice mocking practice one a time.

Study of sports player



Ana talk at Google about mind, training, video is 20 minutes long. 

Julia likes to write down notes, she already watched the videos over 6 times. 


Code Review: binary tree inorder traversal - iterative solution

April 1, 2017

Share the code review:

Binary tree inorder traversal - iterative solution