Saturday, June 3, 2017

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 

Coding Interviews - Harry He

May 25, 2017

Introduction


It is such a great book and Julia read the book back in 2015. Now it is the time to review the book again.

Book reading 


Question 69: Median of a stream (Julia's ranking:  10 out of 10  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 85: binary tree is balanced? (Julia's ranking:  8 out of 10  May 31, 2017)


Algorithm 90: Given an array, check whether it contains a subset of numbers whose sum equals to 0

A little confused about solution discussed in the book, look up Google and then find this blog on geeksforgeeks:
Dyanmic programming / Set 25 ( Subset Sum Problem), recursive and also dynamic programmng solution.

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.

Study Leetcode 39: Combination Sum,
Julia's C# practice is here.

Leetcode 40 Combination Sum II.

Julia's C# practice is here.


Algorithm 93: Maximum in Queue

Leetcode 239 Sliding window maximum

Algorithm 98: Most profit from stock
June 8, 2017
Leetcode 121
Julia's C# practice is here

Leetcode 122
Julia's C# practice is here




Wednesday, May 24, 2017

Leetcode 48: Image Rotate

May 24, 2017

Plan to work on image rotate.

The idea is to visit nodes in the matrix using the order of top row, right column, bottom row and then left column. So the rotate 90 degree clockwise is to shift the array to left.

C# practice is here.

The idea is to first reverse up to down, then swap the symmetry.

C# practice is here.


Leetcode 151: reverse words in a string

May 24, 2017

Problem statement is here.

C# practice is here. Need to work on failed test cases, multiple space, "a   b" should be reversed to "b   a".

Follow up 


April 16, 2017
Mocking experience, reverse words in a string, C# code is here.

June 20, 2017
Mocking experience, reverse words in a string, C# code is here.

Julia learned the lesson how to work on linear scan array hard lesson through Leetcode contest in May, she spent over 40 minutes on one algorithm, and then she read the idea to spend 5 minutes less to write very clear solution. The blog is called Leetcode 605: Can plant flower.


Tuesday, May 23, 2017

Leetcode 37: Sudoku Solver

May 23, 2017

Introduction


Sudoku solver is the most classical algorithm to apply Depth First Search (DFS) using recursion and also use back tracking as well. Julia had a very good experience in May 22, 2017, she had chance to learn to write a short version of depth first search coached by her mocking peer.

Most important design is about base case. To make the implementation as simple as possible, DFS algorithm can start from the matrix left top corner, and then scan from left to right, top to bottom, if the row is bigger than 8, then it finds a solution.


Algorithm Study 



Problem statement is here.

The C# code practice is here.

Algorithm talk 


May 25, 2017

It is also very good experience to use Sudoku Solver algorithm to conduct mocking experience. Julia did her first mocking experience using the algorithm as an interviewer.

June 13, 2017

It is very good experience to write sudoku in mocking experience, this is the third time Julia worked on Sudoku for mocking experience.

Julia put the code into Visual Studio to compile and here is her C# practice code.

Here are two mistakes in writing through mocking experience:

One compiler error in mocking writing, line 61,
add type conversion by adding (char), and also (number + '0')

line 61  board[row, col] = (char)(number + '0'); // add '0'

One compiler error, duplicate variable inside for loop on line 82, change col to column; line 91, row is changed to rowIndex.

Try to pass online judge, and then find the bug on line 84, 93, 111. C# code is here.

line 84 if (board[row, column] - number == '0') // should be '0', not 0



Actionable Item



Julia still remembered that she got some great advice on her second mocking experience using Sudoku, and then she was coached by the peer to use DFS starting from (0, 0) and set the base case to row > 8.

Leetcode 54: Spiral Matrix

May 23, 2017

Introduction


It is a good habit to review the code and then run a few test case to verify the code. Once you finish the white board testing, you tell that you are ready and code is complete. As a software programmer, it is not too late to start to build a habit, examine the code with coding style, run white board testing, and think about possible bugs. Have a high standard, push yourself.

Code design talk


C# code submission is here. Leetcode discussion link is here. Plan to ask a question on codereview.stackexchange.com.

Build a ritual to do white board testing, and write down the test case next to each line of code.


Monday, May 22, 2017

Bronze medal celebration - week code 32 on hackerrank

May 22, 2017

Introduction


It is a small contest but Julia learned how to advance her algorithm research and problem solving skills. Julia still has to learn how to identify advanced algorithm as a classical algorithm in the contest, and then improve her performance from less than 10% to more. No matter how good you are as a programmer, if you cannot relate to the specific advanced algorithm or data structure, the timeout will cause you lose 90% score.

Julia dedicated her effort to work on last two algorithms in the week code 32, she was busy with near 10 mocking experience May 20 - 21 weekend, and then she only had chance to work on those two algorithms. She did not spend time to work on two medium algorithm at all. 

The score is so low, but the bronze medal is the celebration of her brave to solve hard and expert level algorithm, prepare herself to advance her study to two more advanced algorithms - one is called network flow and the another one is called treap tree.


Actionable Items


Study discussion, link is here.

Leetcode 114: Flatten Binary Tree to Linked List

May 22, 2017

Plan to study the algorithm Leetcode 114 Flatten Binary Tree to Linked List. Watch the video lectured by Yu Zhou, the link is here.

June 22, 2017

Julia's C# practice is here.

cc189: 4.2 Minimal Tree

May 22, 2017

Plan to study the video Minimal Tree lectured by Yu Zhu in Chinese.

Treap algorithm

May 22, 2017

Plan to study treap algorithm. Here is the algorithm on geeksforgeeks.com.

Julia played the contest of week code 32, she had a lot of fun to play with the algorithm special substring. After the contest, she learned that the algorithm can be solved using treap algorithm.


Leetcode 39: Combination Sum

May 22, 2017

Plan to study the video about Leetcode 39: combination sum. Here is the video link by Yu Zhou.

Leetcode 47 Permutation II

May 22, 2017

Study the video by Yu Zhou, the link is here.


Leetcode 78: Subsets

May 22, 2017

Introduction

It is so much fun to play hackerrank contest, Julia has to learn how to do a quick research how to identify what kind of advanced algorithm for those hard or expert level algorithm. It is so frustrated to see the score 7 out of 90 on special substrings algorithm.

To get back to normal daily grind, Julia chooses to follow the video from Yu Zhou, learn one algorithm a time, here is the video link on youtube.com.

Leetcode 78 Subsets



The element of style

May 22, 2017

Plan to read the book reading: The element of style.

It is a good idea to read a short book and then learn something about English writing. It is inspired by the article Elements of JavaScript style written by  Eric Elliot.




Ford-Fulkerson Algorithm for Maximum Flow problem

May 22, 2017

Introduction


It is time to learn a new algorithm called Ford-Fulkerson for maximum flow problem. Here is the one article to study on geeksforgeeks.com.

The link is here.

Julia worked on week contest 32, and there is the algorithm she chose to work on called Boxes and Balls. She learned after the contest that the algorithm should be solved using network flow knowledge.

Algorithm study 

Max flow problem introduction on geeksforgeeks.com is here.

The art of programming contest

May 22, 2017

Plan to read the book "The art of programming contest". Julia read the discussion of special substrings algorithm in the week code 32 contest, here is the discussion link. Read the discussion:

"I studied Programming Challenges 3, Programming Contests, Hitchhiker's Guide to Competitive Programming and the Art of Programming Contests. I know what the most frequent algorithms is."



Write down a note to finish 30 minutes reading each time here.

1. May 22, 2017  12:04 pm - 12:34 pm

Chapter 2 Game Plan for a contest

Sunday, May 21, 2017

Special substring - week of code 32

May 21, 2017

Introduction



Special substring is the last algorithm in the week of code 32, and it's max score 81, success rate 9.03%, difficult level is expert, and it ends in 14 hours. Now it is 9:52 am. Julia has to work on the algorithm before 12:00 pm before her first mocking experience starts. She booked herself 5 mocking experience today, and in-between she likes to work on those 3 algorithms in the week of code 32, two other medium algorithms as well.

The problem statement is here.

Coding in the contest 


2:43 pm, first submission, score 16.70. Have timeout issue, wrong answers for the first 20 test cases. 


Ranking study 


It is a good idea to do comparison, and then determine where to gain more points in less time, and also learn and have some fun.

Timeout problem solving 


3:22 pm
Work on timeout issue, pass test case 9, score 20.06


One more progress


3:37 pm, fix the timeout issue, now score 23


Discussion panel 




Read the discussion:

I studied Programming Challenges 3, Programming Contests, Hitchhiker's Guide to Competitive Programming and the Art of Programming Contests. I know what the most frequent algorithms is.

Follow up 


May 22, 2017
code submission is here in the contest, score 6 out of 90. 

Can mock make difference?

May 21, 2017

Introduction


It is a good habit to do some small topic research and then figure out what to look into. Julia did 4 mock experience today, and then she likes to do some research, the topic is "Can mock make difference?"

Study 


Mock interview makes difference.

Things Julia learned through mock experience. Every peer has different talent,  different learning style, Julia learns to speak slowly, clearly, make good points, and then present best talent to the peer. And also Julia learns to review the code carefully as a peer, give hints less or more.

1. Use headset to talk, a few people complained about echo sound.
2. Do not be hacker in mock interview. I have to take the hint, follow the hint.
3. Need to work on the attitude. Set up camera properly, and also give people good impression. Practice makes perfect.
4. Julia enjoyed to learn C++, Ruby and Python through mock experience.
5. Julia learns the importance to practice algorithm and data structure. Peers share their insights.

It is the great to learn algorithms through the mock experience. Now Julia is easy to figure out how people get stuck on one algorithm, one specific issue. She can relate her performance to one of peers, and she knows that her next performance level and how great it should be. She can easily relate to one of her peers and then work hard to improve. She can manage her own thoughts and expectation of her own performance realistically.

Learning algorithm is easy to reach a plateau no matter what you take, by learning from practice, a book, a contest, a code review on the stackexchange.com. But learning from the  peer, it is like having a coach sometimes, the discussion part is also exciting sometimes.

Met peers from New York, Indiana, country of Ireland, Taiwan. Two new graduates and one experienced "It is always in day 1".

Recursive Syndrome


Julia experienced two times recursive syndrome in real experience spanning from 2015 to 2017. She asked herself why, between those 3 years she practiced so many algorithms, why she still failed on the basics, not asking the choice of iterative or recursive, not knowing depth first search (DFS) algorithm can be implemented using recursive intuitively.

She learned through near 30 mock experience, the experience taught her to be super patience.

Last 3 year she only did around 40 mock experience, but 30 of them she did in last 2 months. She first time experience how good she can do to compare with others, if she does not practice at all. To be a learner she has to step out from comfortable zone, meet and talk about algorithms with peers.

Besides algorithm problem solving, there are other traits and characters to help people identify who you are, the way you present, the attitude, if you have high standard for your own code. Have you worked on the basics, coding style, and apply test case in daily programming or not. 30 minutes is a great window for the peer to observe you.

If you are really smart and have a good match with both good performance, then you will find that you two will end up having some time to chat something more interesting, the book you like to recommend, the place you live and sharing of career growth, and other things.

What if 


One day Julia will get used to mock experience, and accumulate over 100 times experience; What she will still excite to go for 101?

Before Julia does not care how others are achieved so much, now she knows that people are working hard and keep quiet, and practice again and again until he/ she feels comfortable with the trials.

Julia knows that each company what kind of level programmers are working there and how she should work on to be competitive, catch up.

Specially Julia thought about young graduate from university bachelor or master degree program, without much experience, what makes them so competitive? The top ranking computer science university, the degree, or high performance in the study of university degree?


Learn to play



It is very good topic to study how to work smart with other people. Through mock experience, Julia learns to improve her speaking English.


Julia has to speak slowly, and also get used to share what she learns. She likes to see if the voice training drill can help her, it is not easy to reduce the accent, improve the pronunciation.

The same idea is in James 1:19,  "let every person be quick to hear, slow to speak." Just speak slowly.

Actionable Items



Mark 30+ mock interview experience, 40+ mock interview experience, one algorithm 3+ mock interviews, 5+ mock interviews,

30+ mock experience:

40+ mock experience: You start to ask what if you are a professional interviewer, interview more than one thousand people already? What are you looking for through the candidates?

Assuming that you have chance to meet people with the range of performance from top 70% to 30%. But with 40+ mock experience, you may have a surprise with top talent and top performance.

one algorithm the first mock -

one algorithm 1+ mock - you start to pay attention more on algorithm itself, you do not care about the ratings you get, you know that you just worked on the algorithm. You love to learn, that is the reason you like to use the algorithm again and again, see how peer learn and solve the algorithm with/ without your contributions.

one algorithm 3+ mock - You cannot believe how busy you are. After 3+ mock on same algorithm, you look into related algorithms. For example, Leetcode 33, 153, 189. You reviewed the discussion on leetcode for different opinions.

one algorithm 5+ mock - No matter how busy you are, you will start to look into the algorithm, try to understand various solutions. Big surprise for Julia to learn Leetcode 10 recursion tree related issues.

70+ mock interview experience - Julia met a peer and the peer asked to work on the extended problem since the algorithm is easy and quick recursive function.

Leetcode weekly contest makes difference - Julia learned the performance lesson 5 minutes vs 48 minutes on easy algorithm, so she applied her learning quickly and shortened the time to 5 minutes writing in mock as well in June - Leetcode 151.

90+ mock interview experience - It is also a good idea to extend the problem for very competitive peer, change the algorithm if you think that peer will accept it. For example, inorder BST successor can be solved using/ without parent node pointer,  there is Leetcode algorithm Inorder Successor. A few of discussions are very detail on how to use DFS search to find the solution.

Always get prepared. Prepare extended question until the peer will fail, then you can measure how deep the strength the peer has.

100+ mock interview experience - It is the first time to learn how to give good advice on hard algorithm Leetcode 10 problem solving, try to explain recursion branches concept. Julia practised over five times Leetcode 10 algorithm.

Saturday, May 20, 2017

Balls and Boxes - balls and boxes

May 20, 2017

Introduction


It is a busy Saturday morning, Julia setup two mocking experience 10:00 am and 12:00 am, and then another one is 4 pm, last one is 8 pm. So in-between she likes to work on week of code 32. Now she has 40 minutes to work on the algorithm, from 3:10 pm - 3:50 pm.

Problem statement of Balls and Boxes is here.

Algorithm 


Progress report - 5/21/2017  12:28 am 

After hours of writing the code, from 9:00 pm to 12:28 am, over 3 hours work, first success submission scored 38 points with only first 4 test cases, failed #2 test case. There are 5 more test cases are not tested.

The score will go down more because there are more failure test cases. Right now, the maximum score is lowered to 57 from 70 since the algorithm has the full score the first day, and then go down next day to 63, go down to 57 the third day.



And the ranking on lead board moved forward from 3000+ to 1022. Let us compare to a Googler: 


Julia looked into the success rate first, and then she decided to work on this hard algorithm. The whole day Julia was busy with mocking interview, 4 mocking experience. She was glad that her effort  on balls and boxes improved her ranking over 1000 once.

Julia reviewed her code and then she tried to fix the test case 2. So she likes to journal some writing on the paper about her thinking process and then share it after the contest.

Learn through the thinking process. Write down all test cases tested in the contest.

May 21, 2017 9:58 am


Follow up 


May 22, 2017
Code written in the contest is here. Score 6 out of 70.

Friday, May 19, 2017

Book reading: The art of readable code

May 19, 2017


Introduction


As a hackerrank contest player, Julia likes to do some research on how to improve her performance. She was surprised that she could not figure out easy algorithm on Hackerrank last year, and then she posted questions on codereview.stackexchange.com, and then she quickly followed the advice. She felt more confident on easy algorithm on hackerrank contest. Here is one of questions she asked on a easy algorithm called Spiral Message.

For medium level algorithm, Julia stumbled badly on Rookie3 maximum score algorithm. She tried to look up the lead board and then tried to find out a good solution to work on her skills, and then she figured out that it is better to work on the basics. She remembered that she read a book to teach how to set up a good test case, and she likes to enhance her skills to use test case for the algorithm analysis.

The book is called "The art of readable code", chapter 14: testing and readability.

Leetcode 480: sliding window median

May 19, 2017


Work on the algorithm Leetcode 480: sliding window median, the blog is here. Leetcode weekly contest 14.