Wednesday, November 8, 2017

Catalan number

Nov. 8, 2017

I will write something here about the algorithm. Will come back very soon.

Transcript is here. I will write down the story later on.



Follow up 


January 17, 2018

It is the advantage of mock interview. I learned the algorithm after I had practive over a few times. But some one with very good talent on algorithm just showed me his way to solve the problem.

The peer just wrote down a 5 x 5 matrix using x to reprent each number, and then he went over the first row, to start from the first row from left to right, write down one for each column; and then go to next row, and then quickly from left to right, add the value underneath and left neighbor in the same row. He finished the process in less than 5 minutes, and then showed me the calculation of value for n = 4.

It is the best coaching experience for me. I learn that some one is much better than me to understand the algorithm. And after mock interview, the peer told me that he got some training in competitive programming before.

Tuesday, November 7, 2017

Leetcode 10: regular expression

Nov. 7, 2017

Introduction



It is such an adventure to work on Leetcode 10: regular expression. I chose the algorithm as my most favorite mock interview algorithm on quora.com last month, the link is here. But of course I was so nervous since I could not believe what I will write down.

My practice 


The peer was very nice and also helpful. I went over each test case and explained the matching, and I told the peer that I will use one of test cases to do whiteboard testing, recursive tree I will use at least 2 branch. For any char followed with *, I will match 0 time or 1 time or more than 1 time.

Here is my C# practice code. I ran the test cases, the code failed the test case with "" and pattern "a*". So I tried to fix it, added one base case, but still failed the test case. The code is here.

I told the peer that I will fix it after mock interview. I already took 43 minutes. Such a great workout.


Discussion between two peers 


Here is the discussion between two peers in mock interview:

how do you match "abb" with pattern "b*b"? Peer asked, and he put down the test case next to line 68.

I think that there are 3 branches in recursion tree:

b* match 0 time, so "abb" will check to match "b", return false;
b* match 1 time, so  'a' != 'b', return false;
more than 1 time will also return fail.

Let us check "bbb" with pattern "b*b", Julia suggested to work on.

We like to check 0 time, 1 time or more than 1 time.

For 0 time case, "bbb" will try to match "b" since "b*" 0 time means empty string. Return false;
For 1 time case, b matches b*, so "bb" will try to match "b", return false;
For more than 1 time case, "bb" will match "b*b", go back to 3 cases, return true.

Show some image to help understand the discussion:


Feedback from the peer



I just could not believe that the peer was a competitive programmer in high school, and then he just finished his computer science graduate school two months ago. He showed to me how strong his analysis was to handle the algorithm and coding was fast and quick later on, he finished in 12 minutes and it seemed to me that he got very good training on the algorithm. Will continue on my next blog Catalan number on the performance. The peer played contest on csacademy.com.


Follow up 


Nov. 8, 2017
The code is updated with code from line 37 to line 41 to fix the base case, empty string "" matchs "a*" pattern string.

C# code is here.


Two peers comparison


It is interesting to know that two peers can evaluate each other with top rating, but how about to compare the profile of two peers and see what we can tell from those numbers.


Divide to n small linked list with length difference at most one

Nov. 7, 2017

Introduction


It is the first time I went through a friend met in mock interview, we both worked on the same algorithm together. I wrote two version of code, one is recursive function, one is iterative one.

Problem statement can be written in the following:

Given a Linked list, split it into x number of smaller linked list where the size difference between any two list should be at most 1


Algorithm practice


It is so interesting to have discussion with the peer outside mock interview platform. I always think like a math major graduate student, the first 5 minutes I will go over anything including mathematics, and then I rested all time. Since I went through the linked list practice in 2016, here is one of linked list practice blog to document my practice. 

I like to observe how the peer picked up the analysis and worked hard on the coding. For me, it is just another routine and I do not need to think about too much. 

C# code is written here, and later on I will compile and add some test cases. 

First, I wrote a recursive solution. The link is here. And then I wrote an iterative solution, the link is here. 

Also, I like to give the code review for the peer's code. The code is here. 


Statistics


Time spent in discussion 7:15 pm - 9:18 pm 



Code review daily read

Nov. 7, 2017

Introduction


Usually there are over 40 algorithm asked in code review, but only less than 10 algorithm will be posted on twitter.com. So I just need to follow the code review twitter account and then I can follow the algorithms every day. Here is the twitter link.

On Nov. 6, 2017, there is a twitter post related to the algorithm I asked. Here is the question:
Sudoku solver recursive solution with clear structure.

Monday, November 6, 2017

Special case of Leetcode 230: Kth Smallest Element in a BST

Nov. 6, 2017

Introduction

It is the hard level algorithm called Kth smallest element in BST. When k value is one, the problem can be called to find largest smaller element in a binary search tree given the number.

It is very good discussion with the peer how to write an iterative solution. I did write down the code using C# and then I have to figure out how to get good rating from the peer.

Here is the C# practice code. I added main function after the mock interview.

Code review 


Here is the evaluation I got. I need to learn how to work with the peer, and follow the hint better.



Follow up 


Nov. 7, 2017
I found a bug in my code, the null pointer exception on line 35:
while(currentNode.right.key < num)


Here is the fix, C# code is here. currentNode.right == null is added to line 41. ( * bug fix No. 1*)

Nov. 10, 2017 11:44 PM

I finally figured out the thing I did wrong in my last mock interview. The code I wrote in Nov. 6 is wrong, and also the fix of bug on Nov. 7 ( * bug fix No. 1*) is also wrong. I finally understood that I was too stubborn and did not take the advice in mock interview.


Also the above code will not work for the following binary search tree:
Given the value 11, largest smaller BST key's value should be 10, but the solution will return 8 instead. Also the above code has null pointer run time exception on line 36, currentNode's right child may be null pointer, need to put a guard clause to check currentNode.right != null.


Nov. 10, 2017
11:19 PM
I had 10:00 pm mock interview, the peer worked on the algorithm. I had chance to find my problem based on the following test case. Great thanks for the peer, who is very patient, and think about the test case carefully.

Given number 11, the largest smaller BST key is 10. How to find node with value 10?   
First, start from root node with value 19, 19 is bigger than 10, so go to its left child. Left child value is 8 and it is smaller than 11, then set the value to look for (denote as LargestValue) as 8. And go to its right child to search. The node's value is 11 which is not smaller than 11, then go to left child 10, and set LargestValue = 10. Node 10 is leaf node without any child. 10 is the answer. 

In other words, find smaller one, go right; find bigger one, then go left. Until the traverse reaches the leaf node. Left, right, left. 

Learning Interface through C# 2000 things

Nov. 6, 2017

Introduction


I got some advice to code to interface through the code review, so I plan to spend 2 hours to go over all interface things through C# 2000 things.

Here is the snapshot:


Code to Interface


It is so interesting to know that I enjoy to go over interface learning through C# 2000 things first. In order to understand the C# array and also IEnumerable interface, I need to go over the basics of C# first.


Actionable Items


Study Abstract class Array

Nov. 7, 2017


Actionable Item

Work on C# Array abstract class study

How many interfaces are derived from?

IClonable
IList
ICollection
IEnumerable
IStructuralComparable
IStructuralEquatable


Properties


IsFixedSize
IsReadOnly
IsSynchronize
Length
LongLength
Rank
SyncRoot

Method ( 10 methods a time)

AsReadOnly<T> (T[])
BinarySearch(Array, Int32, Int32, Object)  Use IComparable interface implemented by each element of the array and by the specified value.
BinarySearch(Array, Int32, Int32, Object, IComparer) Search a range of elements in a one-dimensional sorted array for a value, using the specified IComparer interface.
BinarySearch<T> (T[], T)
BinarySearch<T>(T[], T, IComparer<T>) Searches an entire one-dimensional sorted array for a value using the specified IComparer<T> generic interface.

BinarySearch<T>(T[], Int32, Int32, T) Searches a range of elements in a one-dimensional sorted array for a value, using the IComparable<T> generic interface implemented by each element of the Array and by the specified value.

BinarySearch<T>(T[], Int32, Int32, T, IComparer<T>) Searches a range of elements in a one-dimensional sorted array for a value, using the specified IComparer<T> generic interface.

Clear(Array, Int32, Int32) Sets a range of elements in an array to the default value of each element type.

Clone()
ConstrainedCopy(Array, Int32, Array, Int32, Int32) Copies a range of elements from an Array starting at the specified source index and pastes them to another Array starting at the specified destination index. Guarantees that all changes are undone if the copy does not succeed completely.

Start to read a question:
Why array implements IList?

IEnumerable vs IList

Nov. 8, 2017

What problem does IStructuralEquatable and IStructuralComparable solve?

Nov. 9, 2017
Read C# Array source code here. I found the link in the first few paragraphs of Array document.

Read C# SorterObjectArray - mscor.lib, the link is here. 

Code Review: Sudoku solver recursive solution with clear structure

Nov. 6, 2017

Introduction


It only takes less than one hour to post the question on code review. The algorithm is Leetcode 37: Sudoku solver, the most classical depth first search algorithm. My practice is documented here.

It is a wise decision to ask a question on code review website, this time I learn a few things from code review.


Code Review


Code review link is here.

I got very good review. My most favorite advice is Code to interface. Use IEnumrable<char> instead of using HashSet<char>.

Sunday, November 5, 2017

Shen Neil - Shanghai Jiaotong university alumni

Nov. 5, 2017

Introduction


It is so interesting to be an alumni of Shanghai Jiaotong University, China. I went back to have a vacation this October, I had to meet classmates of undergraduate 70141 and also graduate class 8902.

My undergraduate class is named as 70141, and my graduate class is names as 8902.  I had chance to meet some of my classmates and I had chance to follow more on wechat about their stories. One of 8902 classmate posted the blog about Shen Neil who is my undergraduate classmate of 70141, of course, he is no longer the first degree of my friend circle. My close friend's circle is engineers and teachers of alumni of 70141 and 8902 classes.

Here is the article written in Chinese for me to study in 20 minutes tonight. Chinese sentences are written like this: Four year Shen Neil makes 2 billion dollars, but he invested 50 billion first, in 11 years make 2600 billion dollars.

" 投资教父"沈南鹏,4年赚到20亿还嫌不过瘾,他一举砸下500亿 , 11年创下2.6万亿奇迹!

Study of Shen Neil 


Shen Neil's wiki page is here. 
Shen Neil's wiki page in Chinese is here. 

His partner of Sequoia: Michael Moritz


52 minutes interview called Sequoia's Neil Shen to Entrepreneurs: "Follow Your Heart", the video link is here published by Stanford Graduate School of Business.

Several arguments to look into from the article:

Arguments:

不过天才就是天才,在十几次面试的过程中,沈南鹏就摸到了门道。

此后不到两个星期,他就把江恩理论、5个波浪循环、MBS、CDO、中国国债、布伦特原油报价等问题搞透了。

Facts:

就在另外两个人绞尽脑汁在纸上比划的时候,沈南鹏不到5分钟已经给出了答案。

原来不太懂中国的商业环境,到了1999年,我已经比较‘土鳖’了

Saturday, November 4, 2017

Leetcode 611: Valid Triangle Number

Nov. 4, 2017

Introduction


It is the medium level algorithm. The algorithm is very challenging to lower the time complexity from O(n3) to O(n2) using two pointer techniques or binary search. The peer gave me the hint to lower the time complexity, and then I started to think about binary search with time complexity O(n2logn), and then the peer gave me hint to continue to optimize the time complexity.

Plan to write C# code and also read discussions for the algorithm in short future.




TED Talks: 'Grit: The power of passion and perseverance'

Nov. 4, 2017

Watch 6 minutes video, a TED talk: Grit: The power of passion and perseverance. The article with video link is here.


Plan and budget

Nov. 4, 2017


Introduction


I like to write something about project management and cost analysis, and share my story about my October vacation.

I came back from the vacation on Oct. 20, 2017, recovered from the jet lag, and started to catch up the projects at  work. And I like to document how I learn to plan and how to budget, and understand how I can make things better.

It is time to talk about money, and I believe that a very smart programmer should have learned so many things through years, and I just make you laugh when I share my learning and how I understand the money talk.

Money talk 


Will come back very soon.



Galaxy S6 - Tips, Tricks & Hidden Features

Nov. 4, 2017


Introduction


It is two months to be a user of Samsung Galaxy S6 mobile phone. I enjoy so many things last two months and really like to write an eulogy for my new companion - a refurbished Samsung S6 phone.

As a mobile phone user, I need to keep learning the mobile apps and keep update specially weekends.


Study of the video 


I always said those sentences in my vacation to my sisters, "I do not need a brand new iPhone or latest version Huawei phone,  or a brand new luxury car to help my confidence. I am a consumer and then I tell you what I like to use, a used one."

My point is that it is not too difficult to purchase a brand new phone, I can spend extra $200 or more to get a brand new Samsung S6 this August. It takes so much time to catch up the advanced features for the phone. As a website developer, I also have to educate myself as a product manager for the website, I need to learn how others are expecting to use the mobile phone first, and then estimate how much computing power I can generate and produce a decent mobile website.

12 minutes video is here called Galaxy S6 - tips, tricks & hidden features.

17 minutes video is here called 10 Hidden Features of the Samsung Galaxy S6 You Don't Know About.

Actionable Items


Follow up
Oct. 13, 2019
I found out that I did not learn the basics of investment. I found out that in 2018 I had over $50,000 Canadian dollars with Scotia bank, I earned less than $10.00 dollar interest in 2018.

I also reviewed my US dollar account with Scotia bank from 2010 to 2017, but I did not have any interest. I found out that I wasted so much opportunity, since I missed 10 year bull market from 2010 to 2018.

Leetcode 41: First missing positive (II)

Nov. 4, 2017

Introduction


It is so pleasant to meet a peer through mock interview, and watch and learn how the peer solves the algorithm with a few of hints, write optimal solution to pass all test cases. Through 40 minutes interview, I also had chance to review the code, shared my experience of coding style, how to apply to the peer's code.

It is so exciting to see how I can learn to share my experience just in-time, and help a young programmer to pay attention to coding style. One thing I liked most in mock interview is to show the peer how to break giant expression, what to iterate in the while loop.

Also the peer chose to use C programming language, so I know that she must be a top-talented person, because those machine learning algorithm matches me to top talent in the world this Saturday morning. Only few of us can choose to use C to do interview these days. Through mock interview, I experienced C programming and do not pay attention too much since I need to refresh my C programming knowledge.

Algorithm Talk 




Leetcode 18: 4 Sum

Nov. 4, 2017

Introduction


It is such a great mock interview this morning starting from 10:00 am. I had to work on the algorithm Leetcode 18: 4 sum in the time limit of 35 minutes. I did a few things to make the mock interview great learning experience. I wrote an algorithm, passed the compiling and then passed all test cases without any bug. The algorithm has optimal time complexity although extra space is needed.

Here are highlights:

 1. I chose the algorithm using time complexity O(n2). Two sum pairs are saved to the dictionary for lookup later on.

 2. Whiteboard testing was very helpful, I chose the easy one [3, 2, 1, 4, 5] and the given 4 sum is 12 = 1 + 2 + 4 + 5. Compared to the test case given in the problem statement, this one is easy to follow.

3. Through whiteboard testing, I found a bug in my design. The array may have duplicate numbers, and then I spent extra 5 minutes to change the design, in line 78, I added two extra elements in the array to save index number of the array.
newList.Add(new int[]{no1, no2, i, j})

4. Through the whiteboard testing, I modified the code to make it more easy to follow. I added var no1, no2, no3, no4, assuming that no1 <= no2 <= no3 <= no4, and the index of four numbers in sorted array is in ascending order.

5. I spent less than 3 minutes to fix all compiling errors.

6. The code runs and pass all test cases without any bug.

Code review


The code I wrote in mock interivew in C# is here to view.

Based on my last practice on Leetcode 18: 4 sum in August 2017, I worked on the feedback. I need to write a run-through code, I have to simplify the solution in order to fit in 30 - 35 minutes.

A few things I did are very helpful to expedite the process this time. The most simple test case is chosen to do whiteboard testing; the whiteboard testing is not a fake one, in the process of testing, I found a bug first, and then came out the fix, and in-between I added a few more variables to make code more easy to follow, avoid bugs.

Feedback from the peer


The peer did not choose to use the video, but her knowledge of algorithm is very helpful. I did have chance to learn the algorithm compared to two pointers techniques.



Friday, November 3, 2017

Leetcode 37: Sudoku solver

Nov. 2, 2017

Introduction


It is the time again to write a Sudoku solver. Here is my C# practice, the peer told me that I do not need to run the code using web browser compiler.

The mock interview was supposed to end in one hour to 11:00 PM, but it actually ended at 11:50 PM. I spent more time to chat with the peer until the session terminated due to timeout.

After that, I started to run the code, first I fixed the grammar error line 62. The Split function of string will have an array of string, not an array of char. The line 62 has compile error. It is the easy and quick fix. But I came cross the index out of range run time error. This one I could not pinpoint the error.

I was troubled and tried to set up test case until 1:00 AM, and then I called it a day. I did not do whiteboard testing, instead I tried to guess what is possible places to go wrong for index-out-of range error. With whiteboard testing, it should be a quick fix. But without it, I wasted almost one hour but I still could not find the issue until 1:00 AM.

Whiteboard testing


The whiteboard testing is to use a test case and go over the code line by line, write down the value for each variable, and run the code virtually with results.

If I do whiteboard testing, I should have found the bug on line 91. Here is line 91 with the bug:

for(int row = startRow; row < row + 3; row++)

actually when I run the whiteboard testing, startRow = 0, then row is from 0 to 2. The statement should be written in the following:

for(int row = startRow; row < startRow + 3; row++)


Nothing beats whiteboard testing 


In terms of bug fixing, nothing beats whiteboard testing. Go over a simple test case, go over each line of code, put the result next to the code.

Actionable Item


C# code is updated and it passes all test cases after mock interview. The C# code is here. 

Review sudoku algorithm on code review website, and I studied the question:

Solving Sudoku using backtracking

Plan to write C# code based on the above code review. I feel that there are a few things I can apply to my mock practice code. 


Plan to write a blog to review algorithm of longest common subsequence written in Chinese. The link is here.

Leetcode 41: First missing positive

Nov. 1, 2017

Plan to look into Leetcode and find the similar algorithm called get smallest nonnegative number.

Get smallest nonnegative number, do not change the array.

My C# practice code is here on Nov. 1, 2017

Also, I spent almost 50 minutes to interview the peer on Nov. 2, 2017 and had some discussion about the algorithm. I like the peer to go over the base cases to show very good reasoning.

[],   0
[0], 1
[1], 0
[0, 2, 3]  1
[3, 0 , 2] 1
[0, 1, 2, 10000]


Leetcode 41: First missing positive 


It is the hard level algorithm. Time complexity is O(n), space is O(1).




Thursday, November 2, 2017

Quora reading time: Drew Eckhardt

Nov. 2, 2017

Plan to read more on quora.com, the user Drew Eckhardt's profile is here.

Wednesday, November 1, 2017

Role model on hackerrank

Nov. 1, 2017

Introduction


It is a small world these days, I know that every 6 people can get you connect to any one in the world assuming that you only reach out the person you know.

Today I went over the leadboard of hackerrank woman codesprint, and then I saw one of players and was so amazed about the player's hard work.

The player completed more than 100 algorithm practice on project Euler less than one month.




Leetcode: binary search tree inorder successor

Nov. 1, 2017

Introduction


It took the peer 60 minutes to write a solution to find binary search tree inorder successor on Oct. 31, 2017.  One time the peer asked me who I am, are you a teacher?  I must be very patient and be very supportive.

In fact, I understood that I failed at least 30% of algorithm in the first round of mock interview starting this March. So it is very easy for me to relate to my performance, I am in trouble, and have some difficult time to solve the algorithm.


Algorithm study


Plan to study the binary search tree inorder successor algorithm. Read as many discussion as possible, here is the Leetcode discussion link.

Common bugs for wrong answer

Oct. 31, 2017

Introduction



It is so time consuming to find the bug in my code, and then after almost over 5 minutes, I decided to use Console.WriteLine to help, because I gave up whiteboard testing. The peer insisted that the test case of platform is working, and then I found out that I should add a statement to break the for loop.


Code review 


Here is my C# code.

I spent over 5 minutes to do whiteboard testing, but I could not find the bug. The line 38 break statement is missing. Need to break the for loop.

Actionable Item


Need to work on whiteboard testing. If the result is wrong, then I need to figure out the reason without using debug statement.

Plan to do some research about wrong answer bugs.

The feedback is that "only test 2-3 times".


Play by play: html, css, and JavaScript with Lea Verou

Oct. 31, 2017

Introduction


It is the time to catch up some learning of JavaScript through pluralsight.com. I chose to study the course today, I spent one hour to go over the course, here is Lea Verou wiki page.

First I spent around 2 hours to study code review of JavaScript, the learning of JavaScript was kind of slow and not efficient, so I decided to choose an advanced course to study through pluralsight.com. I chose the course Play by play: html, css, and JavaScript with Lea Verou.



Course Study


Book To Read

CSS Secrets

Nov. 1, 2017
Continue to watch the video, HTML Game View
Accessibility and Styling.



2017 year end JavaScript code review

Oct. 31, 2017

Introduction 


It is the time to review what I have completed in 2017. I like to go over JavaScript and see if I can boost my JavaScript skills in the last two months of year. I chose to study 2 hours code review conducted by BlindMan67.

Code review 



Sunday, October 29, 2017

Leetcode 238: Product of Array Except Self

Oct. 29, 2017


Introduction


It is over 30 minutes to write the algorithm based on the idea using dynamic programming. By going through the whiteboard testing, it took me two steps to come out the code passing all testing cases. First I wrote code to make sure that the value was correct, and then I change the code based on TED principle.

Code study


C# code is here.

I wrote two blogs about the algorithm, the first one is written in March 21, 2016. . The second one is here written in July 24, 2015.




Women's codeSprint 4: Afraid of the dark - after the contest

Oct. 29, 2017

Introduction


It is time to study the algorithm after the contest. I like to study the editorial note for the algorithm - afraid of the dark. It is an algorithm using BFS, DFS, union-find, greedy algorithm. Time complexity can be O(n).

I felt that I have to start all over again, I could not perform the contest in less than 10 hours, I have to dedicate long hours in order to perform in the contest. How can I dedicate so many hours for a contest? How can I motivate myself to stay focus on problem solving?

The problem I have is that I solve more complicated problem than I should. Based on past experience on contest, the solution should be very simple and no complicated code for the contest, specially for medium level algorithm.


Actionable Item


It is a good idea to take 30 minutes at least every day to go over all the algorithms in Women codesprint #4, spend time to write code for each algorithm.

Plan to write C# code for the algorithm.




Woman codesprint 4: Extra Sweet - after contest

Oct. 29, 2017


Introduction


It is time to look into the answer of extra sweet. I started to review editorial notes, look into the leaderboard, and also study test cases. I found the code to study, here is the Java code.

Code study 


As a programmer, it is very important to be able to understand the algorithm in small detail. For some reason, I miss the important clue to solve the problem.

I spent time to look into the code and then finally I understood the idea by studying one of Java submission. Here is the Java code.

Starting from 7:10 am, now it is 8:20 pm, I never had such great time to study those code submissions and concentrated the problem solving.

Here is the design to study through the above Java code:


In the contest, I tried to set up the double linked list, and I like to set up 0's next points to 6, and 6's previous link to 0. Compared to the study code, no array is need. Just set up a map to add 1 as key, 6 as value, and then 5 as key and 0 as its value.

Saturday, October 28, 2017

Women's codesprint 4: Afraid of the Dark

Oct. 28, 2017

Introduction


Now it is 11:19 PM, only 10 hours left for the contest. I only score 19 points, I need to start to work on second medium algorithm called Afraid of the Dark.

It is too late to write code for the algorithm. Now it is 1:51 am. I reviewed the graph algorithm through my coding blog, one popular algorithm is called union find algorithm.

It is not difficult to figure out the solution. We can form the disjoint sets, and then each node belongs to one of set. For set with even number of off light bulbs, the number of visited node is the size of disjoint set. For set with odd number of off light bulbs, each room with off light bulb will have a minimum distance to the leaf node.

Algorithm coding


Plan to write code after the contest.


Actionable Item


It is time for me to review my practice. I felt less engaged to the hackerrank contest, I prefer to read some material on quora.com, but I will be better off to write code and try to push myself to solve algorithm problems.

I do not need to consume so many question/ answers on quora.com. Please limit time to read on quora.com as well.



Women's CodeSprint 4: Extra Sweet

Oct. 28, 2017

Introduction


It is time to work on the algorithm called "Extra Sweet". I tried to enjoy the problem solving but after a few hours I only scored 4 out of 30 points on this medium algorithm.

Progress report 


Now it is 11:11 PM, Oct. 28, 2017. I need to move on next medium algorithm.


Follow up 


Oct. 29, 2017  8:26 PM
After the contest, I did study editorial notes, and also go over some code submissions.

Here is the code I wrote in the contest, I tried to set up linked list to double link two nodes.

Nov. 1, 2017
It is hard to figure out what was wrong with my research in the contest. I did try to figure out the issue, I made 4 submissions.

Extra sweet

First submission - the issue found and then I started to work on, mix the setup of linkedlist with the calculation of extra sweet.

Second submission - set node's left neighbor to the first node with value 0.

Third submission - set line 89 - point to the next point to the dummy node nodes[n] with index value 0.



Quora study: Dmitriv Genzel

Oct. 28, 2017

Introduction


It is the interesting place to see people write so careful and with so much detail on quora.com. Usually I like to read on linkedin.com, but now it seems to me that quora.com is better place to read.

Dimitriv Genzel is the machine learning team lead of quora.com. I like to study one of his post recently. The link is here. His profile is here.


Read one more answer from quora product manager, here is the link.

Read one answer about using competitive questions to prepare for facebook interview, the link is here.


China open quarterfinal Dimitrov

Oct. 28, 2018


Introduction


I spent over a few hours to watch live China open quarter final Dimitrov against Spanish player. It is the first day of my vacation in China, October 6. I could not believe that the experience was such great one, I like to write down some notes and continue to do some research about the player.


The coach team was sit next to me in less than 2 meters, I kept hearing the coaches were calling, "Find ways", "Are you sure". This was the first time I observed how coaches involved the match actively.

I knew the coach crew by watching one of practice video of Dimitrov before. Here is the link called Pushing the limits with dimitrov part one, 5 minutes video. Here is the link of part II, 2 minutes video.


Air canada shanghai to vancouver flight

Oct. 28, 2017

Introduction


It is such a pleasant flight that I like to write a short eulogy for the trip. I traveled with Air Canada Oct. 20 from Shanghai to Vancouver.




Find the smallest substring that contains some given subset of characters

Oct. 28, 2017

Introduction


It is a long journey for me to come out the solution to pass all test cases. I did at least 4 or 5 time last 6 months to work on the algorithm called "Find the smallest substring that contains some given subset of characters". I posted the question on code review, link is here in Sept. 2017.

Today I had chance to interview a peer using the algorithm, I only can hear the voice no video, but I understood how tough the algorithm can be, specially for the first time player. The peer does not work on the algorithm before, and I worked with him near 50 minutes on the algorithm. First 20 - 30 minutes to work on the algorithm itself, I had chance to follow what he approached the problem. Next 20 minutes I asked him to write code so I can evaluate his coding skills and coding style.

The mock interview is such a nice place to meet people and figure out together how to improve technical skills. The conversation is interesting and also very gentle on the topics. I have to let the peer approaches the problem first, and then give some hint, and see how discussion can continue.

The peer is very diplomatic so I know that he must be an important role in his job. First he chose to use JavaScript to code the program, so I complimented him about he must know node.js framework.
Then I noticed that he wrote down some notes to show his logic thinking, it is very clear; he asked my feedback so I know that he is also very good listener.

Mock interview 


I found out that I always get best peer in the world, so I have to keep up with the peer about technical skills, help them to understand their strength and weakness. It is so interesting to have a mock interview.

The test cases discussed in mock interview are the following:
1. yxxz -> "yxxz"
1. xxyz ->"xxyz"-> "xyz"
2. slide window, two pointer technique
left pointer and right pointer
3. Move right pointer first, and then find a substring; and then move left pointer to make the substring smaller if possible.

For analysis, if the peer can come out the test case like the following: For example, for search string ['a','b','c'], source string "aefbcgaxy", the shortest string is "bcga", the peer has excellent analysis of algorithm, assuming that the peer does not work on the algorithm before. 


Julia's practice 



It is also a great idea to review my practices:
April 2015, blog is here.
April, 2017, it is documented here.
June 29, 2017, mock practice C# code is here.
Sept., 2017, it is documented here.
Code review is here.

Oct. 31, 2017
It took me three years to fully understand the algorithm and how to work out a perfect solution. This experience taught me how to treat others, more patient please. And this is the really great algorithm to evaluate the candidate the algorithm analysis and technical strength.

Friday, October 27, 2017

Code review "LINQ and string.Split do it yourself practice" (II)

Oct. 27, 2017


Introduction


It is the first time I understand that the technical strength can only be trained by dedicated practice. Today I had chance to walk through those five lines of C# code, and explained to the peer how to apply those things in C++ code.

Will come back to document more about the experience as an interviewer. My last blog about the code review is here less than one month ago.


Algorithm talk 


The peer likes to write C++ but the complexity of code is beyond his expectation. 30 minutes is too short to come out the workable solution.

Here is the C# code written by code review on stackexchange.com:


Each step in the above C# code can be a small function written in C++ if the peer does not know the regular expression, or similar LINQ method. 3 or 4 years job experience does not help to train yourself to be a good C++ programmer. You need to train carefully.


Actionable Item



Plan to do some research about post vacation syndrome. I need to get out of relationships from the family back in China, less frequent using wechat to communicate family in China anymore, and get back to my normal work day in the city of Vancouver. One thing I choose to do after I overcome jet lag is to practice mock interview every day 10:00 PM. Need to meet new people and learn more about the industry and people.

Give myself a pat on my shoulder. Show my report of first mock interview after a month break.

Thursday, October 26, 2017

Whiteboard testing is the savior

Oct. 26, 2017

Introduction


It is the best decision to practice mock interview starting from today. As usual, I choose to practice 10:00 PM since it is too late to work and usually I am so tired, usually I have difficult time to think clearly after long day, I like to drill myself to simulate tough situation at work. My last practice is Sept. 27, 2017. Since I took a vacation from Oct. 5 to Oct. 20, I did not practice mock interview at all.

Today I spent first 15 minutes to write code, and then I relied on my techniques using Terse, Express the intent, Do one thing (TED) principle, and then I made the change to look ahead to determine if it is ready to compare (line 33: readyToCompare), I passed all test cases in the 35th minute.

In summary, the algorithm I had to write is a linear scan algorithm, instead of looking ahead to determine if it is the last row in the current time stamp, first 25 minutes I worked on the idea to look backward to compare to previous time. Once I play with whiteboard testing, I figure out the solution 100% correctly.


Code review



C# code is here. Plan to highlight a few changes I made.

Line 29 - comment out line 29, the peer reminded me no need to use startNewTime, previousTimeStamp

Line 40 - max = sum;  // the peer reminded me that sum is the new max value.


Actionable Item


Usually linear scan algorithm I should aim at 10 minutes to perform.

What are top 10 lessons to write a coding blog?

 Oct. 26, 2017

What are the top 10 lessons to write a coding blog?


I like to introduce myself first. I started to write a coding blog from January 2015 just after I failed an algorithm interview in the city of Vancouver, Canada.  As usual, I felt disappointed to myself, but this time I decided to write down my journey. I set up a goal too high for me to reach it. If I cannot be a top player, maybe I should at least try to be the coach for top players one day. Write down my struggle and failure, make it valuable to others.  

As a first time blogger, a coding blog blogger, the first 6 months to 12 months, I was afraid to write down my thoughts as well, and I do not have a lot of ideas to write. But I start to learn how to organize a blog, how to design a blog, how to write in 5 minutes and have a good blog to entertain myself every time I feel down. After 24 months, I have written more than 1000 blogs.

There are millions programmer jobs these days. But do you find that it is hard for you and me to get a desirable job and advance your career successfully? Is it difficult to find a popular name to relate to good and real story about hard work as a software programmer.

In terms of coding blog, do we have a good brand household brand everyone can relate to? Just be brave, dare to be number one, you should start to write your own coding blog starting today. You may be the one who inspire million programmers.

How about a two year old coding blog called Julia coding blog? That is my coding blog: http://juliachencoding.blogspot.ca/.


Top 10 lessons for a coding blog


1.       Coding blog can be very short. Do one thing a time. Work on one algorithm a time. I used to write a blog to review over thirty computer algorithms, it is hard to organize so many algorithms in one blog. 
2.       Write down your coding practice. Stay focus on coding practice. Write down how you feel, do not make it like a textbook, or journal paper, or a conference paper. Include some statistics to help track progress later on.
3.       Be creative. It is your time, you are the author. Think more about serving yourself very well. How can you learn from a coding blog?  You are teaching data structure and algorithm for the future yourself.      
7.       Have some humor. Every time I like to write down something, I notice that I need to practice coding first, or play a contest on HackerRank, or set up a mock interview. No matter how busy I am, I have to find time to write code. Sometimes, it is embarrassing because the ranking of contest, the poor performance I have on the last contest.

8.       Set up a high goal is always a good practice. Learn to be a coach. 
I do have a nephew who just graduated from computer science bachelor degree one year ago. I like to coach him one day to be a top programmer. I need to prepare early, I am more motivated to work for my coding blog.  


  . Discipline yourself. I often try to choose a topic for my blog to make it more outstanding. Once a while, I will choose a bible verse as my blog title. I like to write something with facts, arguments, and also something inspiration. Avoid risky topic to bring controversy.
5.       Make it casual. I also wrote some blogs about tennis sports, top 10 success rules, and other research I do daily.

6.       Read a lot of your own blogs, and rewrite. I got complaints from my friends about grammar errors etc., instead I learn to write and use a new word in each blog, improve and expand my vocabulary.

More about coding blog



Let me explain how I manage my coding blog as a designer, product manager, a thinker and also a code writer and a Hackerrank contest player.  

Coding blog is more controllable 


1     Write a lot, produce a lot of content. I pursuit a lot of goals but failed to achieve, things are not under my control. But a coding blog published using Google blogger, it is very easy to start and manage these days.  

Blog is my product, and I am the product manager of my blog, also I need to do marketing and invest a lot of time to the coding blog product.

Sports training


2     The past 24 months, I played a lot of tennis sports. I train myself to follow professional tennis player, and use the sports to train myself. I like to train myself in a few areas, sports techniques, new school of entertainment, mental toughness, and how coach educate young players, drills of sports, tournaments, rankings. I need a place for me as a sports fan to document the journey as well, share my stories.

     Long term work 


3      Learn how to get more organized and stay connected to my past work experience. I like to write down my thoughts so that I can analyze my thought process later, sometimes an advanced algorithm and data structure takes months and years to master, like union find, regular expression algorithm, dynamic programming.

     Easy to access


4      It is easy for me to write a blog compared to get connected to a person through meetup or other activities.  Also I like to demonstrate how good a person can be to work on a project. How hard it is to work on a goal, like solving an algorithm problem, how many submissions to succeed to solve a problem on Hackerrank.

    Writing Principles



5     I do not have a mentor to help me to write blogs. I need to find out the principles to help me to write, and also help me to think clearly and logically.

    Bad habits 


6     I have a lot of bad habits to get rid of, like impulse shopping, peer pressure, unhealthy diet, and lack of sports training, competitive sports training. One solution is to build a new good habit, write a good coding blog every day.

7     I worked on my computer science Ph.D. program from 2001 to 2011, but those 10 years I did not build a good habit to write programs for data structure and algorithms daily, research daily. Coding blog will force me to stay on the track to work on my crafting skills, a good thinker of algorithm and data structure.

    Community 


8     I like to figure out how I can get more involved in the community I live, I like to be an educator, engineer, counsellor. Coding blog is not a bad choice.

    Less Democratic


9     I read a lot of blogs, and I know that blogging is cheap and efficient way to publish. Although it is not so popular, it is safe and sandbox to get more experience without worrying about down votes.

What are top 10 questions to ask yourself as a software programmer?

Oct. 26, 2017

Plan to write a blog and answer the question on quora.com. The question is "What are top 10 questions to ask yourself as a software programmer?". The link is here.


Oct. 27, 2017

It is the fact that I stay at current job over 7 years. Last 3 years, I work day and night, and try to work on data structure and algorithm, work on solving leetcode algorithms. I finally can say that I can write much more efficient code, wish that I can write a better product for the business.

I ask myself a lot of questions. Let me put down a list first and then sort out by the categories.

New roles 

Can I be a good project manager?
Can I be a product manager to manage myself?

When I document my experience through coding blog, do I demonnstrate good skills as a product manager or project manager?


Hackerrank contests


Do I have more time to play hackerrank contests and win more medals?
Do I regain the passion to play hackerrank contest after I won my first gold medal?
Do I still work hard to study lead board of hackerrank contest and then try to figure out something new to learn?

Do I have freedom to rewrite the whole website using some fancy technology I learn recently?

How long should I choose to work on programming job?
When do I notice that I need constantly review what I have done and then code review, rewrite the code?

Simplify the engineering 



How is the review of cache design in the website?

should I continue to do some research on website cache design issue?


Training 


What percentage is to train myself coding?
When to train myself?
What to train myself?

How to bring people to my working relationships? How to form a circle?


Goals


What is my 6 month goal?
What is my 12 month goal?
How many hours to spend on pluralsight.com to learn some new tecnologies?

What are top 10 surprise to write a coding blog?

Oct. 26, 2017

Plan to write a blog and answer the question I ask on quora.com. Here is the question link.

Oct. 27, 2017

Top 10 surprise:


Most my favorite algorithm is Leetcode 10, regular expression.
Most my favorite time is to practice mock interview
Most my tough time is to try to break into an advanced algorithm on hackerrank contest


I like to write other topics as well. One day I noticed that I wrote down the topic called face paralysis.

Wednesday, October 25, 2017

Code review follow up

Oct. 25, 2017



Introduction


It is a good habit to read code review again and see how many things I should work on to improve my csharp code skills. Today I spent 20 minutes to review the algorithm and wrote the csharp code based on code review.


Follow up


Originally I asked the question on code review community 27 days ago, the experience is documented here called

Thanksgiving campaign No. 1


Oct. 25, 2017

Code review C# code is here. I will look into those changes later. 



Actionable Items


I like to figure out how to market the question on quora.com, therefore, I may have to ask a question and then try to target those undergraduate students who are working on C# course or object-oriented programming. 




Sorting an Array of Values Based on an Array of Keys

Oct. 25, 2017

Introduction



One apple a day, keep doctor away. One program a day, also keep programmer awake. Today a small program keeps me awake to look into a few things, ...

I like to share my practice using C# 2000 things, item 136: Sorting an Array of Values Based on an Array of Keys.

Here is the C# code.

Read the code and enjoy the workout.


Sorting an array using an independent Comparer method

Oct. 25, 2017

Introduction


One apple a day, keep doctor away. One program a day, also keep programmer awake. Today a small program keeps me awake to look into a few things, IComparer vs IComparable. 

I like to share my practice using C# 2000 things, item 137: Sorting an array using an independent Comparer method.

Here is the C# code.

Read the code and enjoy the workout.

Implementing IComparable to Allow Sorting a Custom Type

Oct. 25, 2017

Introduction


One apple a day, keep doctor away. One program a day, also keep programmer awake. Today a small program keeps me awake to look into a few things, IComparer vs IComparable, throw new ArgumentExcecption on line 44. 

I like to share my practice using C# 2000 things, item 135: Implement IComparable to allow sorting a custom type.

Here is the C# code.


Tuesday, October 24, 2017

Hackerrank: Women's CodeSprint 4

Oct. 24, 2017

Introduction


It is the time to play another codesprint this Friday. I thought about yesterday and decided to join until this Thursday, because I need to discipline myself to work on the contest. It is not an easy task because of the busy schedule.

Here is my last two contests on Hackerrank.


I documented the university codesprint 3 contest here. I just could not believe that after the contest, I wrote the blog to celebrate my piece of puzzle to solve NIM game. It is just another contest, and not so good performance. Surprisingly, I got some feedback through a phone call, unbelievable story in the city of Vancouver. 


CodeSprint strategies 


I spent extra 20 minutes to look up bible verse for my contest. Here is bible version Proverb 13:4 for my woman codesprint 4.

Statistics


The blog was written from 6:00 am to 6:20 am, Oct. 24, 2017. I just came back from China and went back to work starting from Oct. 23, 2017. I need to get rid of jet lag, I came back on Oct. 20, and this is the fourth morning with jet lag, I went to bed around 8:00 PM, and woke up around 3:00 AM, and then read wechat to 5:00 am, and got up at 5:30 am.  



Leetcode: binary tree upside down (II)

Oct. 24, 2017

Introduction


It only takes around 20 minutes to read a recursive solution on the panel of Leetcode discussion. I read the solution this morning around 3:00 am. Now it is 5:43 am, I got up and started to work on my computer and blog this algorithm.

Code study 


It is better for me to choose one of discussion, and check in the code, and then plan to write C# solution later. 

Here is the discussion link.

Analysis 


Most important is to read yfcheng's analysis. Plan to spend 20 minutes to read and also review the drawings. And then I will write down my own words, and make a drawing as well.

Java code 



Recursive solution in Java code:

Iterative solution in Java code:


Actionable Item


I finished the blog at 6:00 AM, only 15 minutes. Will come back to work on the algorithm based on the discussion. 

Monday, October 23, 2017

What one tip changed your writing forever?

Oct. 23, 2017

Introduction

It is now 7:48 am, I finished my morning work from 5:00 am to 7:50 am, last 5 minutes I wrote an answer on quora. Here is the link: What one tip changed your writing forever?

Finally I need to take some time off and prepare for my breakfast and lunch and go to work.


IIS administration

Oct. 23, 2017

Introduction


It is time for me to get back to work on Internet Information Server (IIS) administration after the vacation. I delayed the project because of my China vacation.

Plan to watch a few of Microsoft IIS administration videos first.


Outco research

Oct. 23, 2017

Introduction


It is Monday morning, 6:14 am. I plan to spend next 30 minutes to do research about outco through yelp. The link is here.

Word of mouth marketing is the best one and I could not pass this one. I got an invitation for a mock interview practice "upside down binary tree" last Saturday, and then at the end of practice the peer shared her experience with outco career counseling.


The research


Plan to read all recommendations on yelp.com first.

Read this answer on quora.com, the link is here.

Actionable Item


Think about providing career counseling service as well. Need to figure out who is the competitor, and most valuable content in the teaching material.

Good morning Vancouver!

Oct. 23, 2017

Introduction


It is the first day to go back to work for MP Lighting after 2 weeks vacation. I got up around 4:30 am, and then I have chance to work on some preparation before I leave the home.

Now it is 5:06 am. Although the jet lag is hard to play with, I feel that it will be a wonderful day.




Yichun university study

Oct. 23, 2017

Introduction


I like to do some research on Yichun university, and see if I should put something into my daily routine.

I had chance to meet my high school classmate during October vacation back to China. My classmate started to work for the university starting from 2016. He got a EE ph.d. degree from USA and then he plans to work for the university for a few years. I did have chance to talk to my other classmates who are professors in the university working there over 20 years as well.



Sunday, October 22, 2017

Leetcode: binary tree upside down

Oct. 22, 2017

Introduction


It is so nice to get a friend's help to offer me to mock interview the algorithm "binary tree upside down". I spent around 100 minutes to work on this algorithm.

Here is the C# code I wrote in the mock interview on Oct. 21, 2017 from 8:00 pm - 9: 53 pm.


Follow up 


Plan to read the leetcode discussion on the algorithm, the link is here.