Wednesday, September 20, 2017

Leetcode 171: Missing Ranges

Sept. 20, 2017

Plan to work on the algorithm called "Missing Ranges". The leetcode discussion link is here.

Problem statement:

Given a sorted integer array where the range of elements are [lowerupper] inclusive, return its missing ranges.
For example, given [0, 1, 3, 50, 75]lower = 0 and upper = 99, return ["2", "4->49", "51->74", "76->99"].

Understanding C# Array class

Sept. 20, 2017


I had a mocking interview at 10:00 pm, and I like to write Array.IndexOf but I need to search Google for the help. I asked myself why it is not array.IndexOf() instead of calling an abstract class Array.IndexOf assume that array is an object of Array class.

Here is my C# practice. I has a few issues to use Array.IndexOf instead of using hashmap to save the index.

Understanding C# Array

I like to read a few articles to get more educated on C# Array.

Read c# Array -
Read 10 minutes - C# Arrays Tutorial

20 minutes reading:

Study stackoverflow posts related to C# Array -

More reading:

Work on C# array 2000 things, the image are highlighted by search keyword: Array

#136, Sorting an Array of Values Based on an Array

Julia's ranking: 10 out of 10

#135, Implementing IComparable to Allow Sorting a Custom Type

9 out 10

#137, Sorting an Array Using an Independent Comparer method

9 out 10

Plan to work on medium level algorithm called "Non-overlapping intervals". The link is here.

Leetcode 57: Insert Interval

Sept. 20, 2017


It is definitely a good learning process to help the peer work out the optimal solution to solve intervals. I had a mocking interview 10:00 PM, and I had to spend over 30 minutes to help the peer to work on an interval algorithm. The difficult part is to explain the idea to use linear algorithm to solve the problem. Also, I gave the hint to show how to get the overlap quickly using Math.Max of beginning of two intervals and Math.Min of ending of two intervals, and then I gave the hint to move to next interval if the ending value is the smaller one.

I gave out the code review about a double for loop, and explained to the peer, in order to get linear time complexity, the while loop should be used instead of using double for loop.

So after the mocking interview, I like to review interval algorithms in Leetcode.

Plan to work on hard level algorithm called Insert Interval. The link is here.

Tuesday, September 19, 2017

To be a good tester

Sept. 19, 2017


Thing happened so quickly and I could not figure out what was going on. This past Monday I installed a few apps on my new refurbished Samsung phone, somehow, the mobile got hot the whole day and I could not get the mobile charged to full the whole day. I went home and charged the Samsung 6S to 80% battery, and left the phone on the table. Next Morning I tried to open the mobile phone around 8:00 am, the phone had 0% percent battery.

Samsung phone battery issue  

To be a software programmer and try to be a good tester, I like the challenge to figure out what the issue is. Is Samsung phone's battery bad? Or I just picked up some bad behavior to download apps not good for the phone. 

A lot of area I carefully go over. Now it is 11:53 PM, the Samsung 6S phone has 24% battery, I will let it sit until tomorrow morning and see what percentage is left. I uninstalled all apps related to maps. 

Sunday, September 17, 2017

Case study of getting better on driving

Sept. 17, 2017


I like to drive highway and enjoy high speed driving. Today I should drive to Road 3 in Richmond from my home to meet friend visiting from Seattle, friends long back from Florida, I ended up driving 91 to Nelson exit, and then turned back to drive local highway and spent extra 20 minutes to get to the restaurant.

Here is my route in a diagram:

Analysis of Driving skills

It is the important to build a good habit, stay intelligent. I drove over 22 times to go to USA cross board last 7 years, but last 2 - 3 years I stopped driving on shopping trip instead of working more on coding blogs.

I need to do some research how to build skills smart on driving. The mistake to take wrong route on the highway reminds me how gentle I should take it, and then later I need to study the reasons, I need to catch up with some learning.

Figure out things to help me to be a good driver.

A few ideas to work on:
1. Read highway 91 or 99 wiki pages.

2. Figure out how Samsung Google map driving direction on my Samsung mobile phone came out ads when I need to get detail route while driving from road 7 to road 8.

3. Understanding Road vs Ave vs St. Directions of Road is north to south.

4. Learn to read map and thing to help to memorize the map and figure out easy mistakes to work with Google directions. Start from basics, reading some articles:

Five tips and tricks to help you better navigate google maps, here is the article.

Facts to Review 


What I did is to purchase $1.00 dollar internet service, and then start to use Google map drive directions on Sept. 17, 2017. The phone was connected to the charger all the time, and then the phone got hot.

What I should do is to download the map of Vancouver area, with size around 160 MB. And then open the download map, use offline map to help drive direction. No need to connect the phone charger. Keep the phone cool as normal standby status does.

Have my idea of route first, only use the drive direction from Google map as an alternative. Understand the basics to exit early, go to No. 3 road first.

tennis coach Annacone study

Sept. 17, 2017


I am looking for great advice for my career. I certainly have got a lot of good advice from last 6 month through over 90 mocking interview peers. But I am still looking for the tennis coaching, and observe best coach teaching. Today I will study Roger Federer's coach Annacone. I decided to study tennis player Madison, and then spent 5 minutes to study Madison twitter account, and then I came cross the book twitter of Annacone.

Study of 30 minutes

Now it is 10:19 pm. I will search google and find 3 of very good study material to entertain myself next 30 minutes.

It is 10:51 pm. I am watching 3 minutes teaching video from the coach Annacone, great teaching. The video is here called "Playsight tennis tips with Paul Annacone: Approach Shots".

It is 11:06 pm, I am in the middle of 22 minutes of teaching video called "Tennis Channel Academy - Paul Annocone (former coach of Sampras & Federer). The video link is here.

Action Items

I miss those long hours to play doubles in the city of Burnaby central park last few years. But this year I do not play so much matches. I really enjoy the learning of double tennis through the favorite video teaching. It is 11:43 pm, I am watching second time the video of following teaching, and catch up some research for my Google map and directions common mistakes.

Here it is. Tennis channel academy Tim Blenkiron, here is the link.

Madison Keys tennis player study

Sept. 17, 2017


I was advised a few times on Burnaby city tennis courts to study woman professional tennis players, and see how they plays. Tennis sports is such a quick pace sports, I have to catch up a lot of study in order to learn and know players. Today I like to spend 20 minutes to study a player Madison keys, basically my study is to focus on how the player thinks and how to solve problems.

Study of a tennis player

The most favorite study is to watch the interview of Madison Key after Rolan-Carros 2016. Eight minutes video is here. She is a young player, only 22 years old, prize money is around 7 million dollars.

9/19/2017 8:30 PM
Madison Keys press conference (SF) - Australian Open 2015, 20 years old Madison shared her thinking about success, motivation to work hard and showed her great manner to handle the tough questions. The video of 11 minutes is here.

Most of my favorite time is to watch her practice. The four minutes is here.

9:07 PM
2017 US open: Madison keys QFs Press Conference, 9 minutes interview is here.
Nervous and how to handle it? 1:00 - 1:27, 27 seconds
Coach helped her - an example, 1:30 - 2:00, 30 seconds
Low moments, dark moments, 3:00 - 3:30, 30 seconds
Americans in QF? talked about opposite first, then go to the topic. Starting from 5:20
Talk about fear. Start from 6:06 PM.
It is not you make people happy, you win matches. It is because you are truly like to be out there. 6:50 - 6:57.
Opportunity as an individual? Take this tournament one match a time, one game a time. I am definitely not getting  ahead myself that way. I am really proud of myself to get here the first place. Starting from 8:00 - 8: 30

10:11 PM
Madison took the interview when she was 16 years old.

US Open Wild Card Exclusive Video: Womens Champion Madison Keys Press Conference. 10 minutes interview is here.

3:16 - go in and prepare like any other match. Do not make it a big deal, otherwise you come in and completely nervous. You will be over thinking, so (3:24) I have to go in and treat it as any other match.

How to Make Your Business Even Better While You're on Vacation

Sept. 17, 2017


It is a good research topic for me to do some research called "How to make your business even better while you's on vacation". I read the Chinese version from here first, now it is 9:00 pm. I like to read English version of the article, and bring up 2 or 3 things to look into.

Saturday, September 16, 2017

Leetcode 33: Search in Rotated Sorted Array

Sept. 16, 2017


It is the wonderful learning opportunity for me to practice the algorithm again last night at 10:00 pm. I chose to write the idea I thought about and read about, but I had not written it before. The experience told me that binary search basically is also like a depth first search, the most important is to work on base case.

The more detail is like this, I spent first 15 minutes to exchange ideas with the peer, and then only 13 minutes left, I need to write some code, and I chose to write a binary search combining normal binary search in sorted array and shift array binary search. My argument is that the normal one is just special case of shifted array binary search. The iterative solution is hard to avoid duplicate logic and coding. I just could not believe that I made it the first writing without any bug or grammar error.

Leetcode 33 is a medium algorithm, I wrote down the algorithm in less than 13 minutes, and most important thing I did is to move base case "middle value" (line 29 - 32) to the first thing inside the while loop, moved those 4 lines out of if block from line 36 to 46.

Tip to share 

I got the complaint about my practice of binary search tree. The peer told me that the most important part is to work on middle value in the binary search tree. Focus on middle value, do not consider start value at all.

Algorithm practice 

C# code practice is here

Thursday, September 14, 2017

July 18, 2017 algorithm review

Sept. 14, 2017


It is two months ago, I did spend 3 to 4 hours to review my own practice before 8:00 pm. I went over around 30 algorithms, print one by one on the paper, and then read one by one. I really learned from the preparation, and I like to open a folder on my own github, and list all those algorithms I chose to study on July 18, 2017.

It is so interested to know that once I am busy with the study, the nervousness is kind of going away. I did very good one on preparation, and I had great performance later on the evening to complete code in limited time.


Mathematics for computer science

Sept. 14, 2017


I reviewed a lot of computer science books and then found an excellent book to read. I am very good at reading mathematics and also like to learn how to think about more using mathematics, help me to be a competitive programmer.

Actually the revised version is over 1000 pages. But it is still my favorite book. I have to find time to read the book. The book is available on website, the link is I also save it on my github and here is the link.

Tuesday, September 12, 2017

Apps for language tests

Sept. 12, 2017


Plan to do some research how to improve my English. I did some research and downloaded some android apps today. Here is my favorite article called "15 Android Apps For IELTS, TOEFL & GRE Preparation".

It is a good idea to continue to work on my English, specially work on the vocabulary. It is important to add some pressure to daily life, such as memorizing 20 new words a day, difficult level of GRE/ GMAT words.

In order to be a top performance player in C# programmer, I start to try new ideas how to improve my performance.

Catalan number (II)

Sept. 12, 2017


It is the classical algorithm to calculate the catalan number. My last practice is documented here. It is very challenge to work with the peer and I ran into the index out of range error in my first writing, and then I modified the code, and argued that first row and first column should exclude from the double for loop, and discuss first row and first column separately.

I need to work on the algorithm problem solving, need to look into the feedback.

Algorithm practice 

C# practice code is here which passes all test cases. 

From the above feedback, I did not communicate very well this time. Need to figure out how to clarify of my answers and line of reasoning. 

2,000 things you should know about C#

Sept. 12, 2017

2,000 things you should know about C#, the link is Plan to work on 2,000 things as quick as possible. 

I did some reading on C# tutorial, and then I came cross this blog and it should be very helpful for me to learn C# in quick pace. I like to read the code and learn  a concept in the same time.

Monday, September 11, 2017

Leetcode 72: Edit Distance

Sept. 11, 2017


It is one of classical algorithms related to recursive function and also memoization. I have practiced a few times and I am still learning the algorithm. My last practice is documented here, and all past practices are available through the search by Leetcode 72.

It was such great experience to be interviewed using the algorithm again. This is my third algorithm practice, my last practice was more than one month ago. I still remembered the mistake I had and the advice I got from the peer.

Algorithm practice 

Here is my C# code written in 30 minutes. I had a mocking experience starting from 10:00 pm.

I knew that I have to work hard to be an interviewer in order to get unlimited credit. I just started my new round of mocking practice. I could not memorize the algorithms, there are a lot of new issues coming out on this algorithm. I failed to do analysis of brute force solution, it should be 2(max(str1.Length, str2.Length)), because every time there is at most 2 choices. I was given the hint and then I took the hint to go from n * m to power of 2 analysis. In other words, the time complexity is lowered from polynomial time to quadratic time.

Assume that the worst case happens. In other words, the comparison of two chars are not equal, so one of them has to be deleted. There are two choices to do deletion, the minimum value of two choices will be recorded. For example, two strings are "abc" and "edfg". The total choices are at most 27. In mathematical term, the upper bound is 2= 512. The dynamic programming using memoization will lower time complexity using jagged array memo[3][4], time complexity 3 * 4 = 12.

I also was told to make correction on the first line of the function, line 8. The checking is for the case of both strings are null or empty. Not at least one of them. I wrote || by the mistake.

Related to a simple life choice


It is always good idea to write down the practice experience, what did I actually learn from the mocking? This time, 30 minutes coding passes all test cases, with one of corrections from the peer. But I was surprised to know that I need to grasp the basic algorithm analysis, as I shared my knowledge of Monte Carlo algorithm to a young graduate from a linguistic major, I have to explain the algorithm to myself. The most important is to know how to analyze instead of guessing.

If I have two choices to calculate distance, how should I make a decision? I have to go for the minimum one from the two choices. If I have a series of choices to make, then the combinations of choices will be 2n. To summarize, Leetcode 72 is the algorithm for me to teach myself how to understand the brute force solution with polynomial time complexity, know how to solve the problem first, and then apply dynamic programming, lower the time complexity to m * n using memoization, dynamic programming using bottom up solution.

It is interesting to know the memoization design, the best choice I know is to use jagged array, memo[][], the size of jagged array is str1.Length * str2.Length, that is how many intermediate result we have to hold. Assume that each of them is calculated to use a few simple steps which are O(1) time complexity. 

Sunday, September 10, 2017

Course study - Advanced Software Development in Full-Stack JavaScript

Sept. 10, 2017


It is very challenge for me to get out of my comfortable zone and start to learn new technologies, I was so busy last 2 - 3 months to review the code I wrote at work, and then I like to plan to develop something more complicated.

I started to work on algorithm and data structure foundation from 2015, and I made some progress and tried to get better through mocking interviews.

Course study 

The course is listed on, the outline of the course is clearly documented in the following link.

Learn to be a mentor to help young girls get involved in STEM

Sept. 20, 2017


It is the great time to spend 20 minutes to read the article titled "Meet Three Awesome woman helping young girls get involved in STEM". The article link is here.

Be a mentor 

Plan to study the linkedin profile: Nicole Kelner and go over the article "A young woman's etiquette guide to coding".

Plan to study the codeFollows institute, the link is here

Saturday, September 9, 2017

What if I am the product manager of Samsung 6S mobile phone?

Sept. 9, 2017


It takes hours to study how Samsung S6 are designed to fit so big population. I spent time to watch Netflix TV shows called "Quantico", meanwhile I plan to go over the features of my new cellular phone, since I hiked 8 hours labor day long weekend in Golden ear canyon loop with other ten people, I soaked my old phone in the water.

Need to go over the articles one by one. What if I am the product manager of Samsung S6? What are those features I need to explore this time?

I plan to try some apps for Samsung S6 phone.

One feature a time 

9/9/2017 10:35 pm - Gboard - the Google Keyboard. The article is here to read.

I really like the Gboard, search is most important feature when I write on wechat to get connected to my friends. Good job, Julia! Well done!

9/9/2017 11:09 pm - Go over those apps and try one more. The link is here.
11:17 pm camera apps - the link is here.

9/19/2017 8:00 am - the phone has zero battery, last night the phone was charged to 80% battery near 8:00 pm. The phone was sitting on the table and no usage at all.

Need to look into possible issues.

Battery issue - the article is here.

A short research - ping identity

Sept. 9, 2017


It is not easy to consider carefully what to adopt with so many technologies. It was the first time in last seven years I started to experience personal developer version starting this August 2017.

I had a strong belief last 2 years that the work I can do is strongly tied to how strong I can be in data structure and algorithm foundation. Every other challenge is to depend on how quickly I can google and pick up the skill set if I need, learn through courses and ask help on

I like to study a local company called ping identity instead of taking another mocking interview. I was busy with the financial work and work on the property safety issue related to rental property in the city of palm beach, the hurricane Erma. Last seven years, I enjoyed the living in the city of Vancouver, but I used to stay in Florida near Atlantic ocean.

30 minutes research 

I did security wireless network research over two years back from 2001 to 2006 my dissertation research. I am kind of remembering taking "Introduction to Cryptography" and exchanged ideas with the classmate how she likes to get the job later.

I need to figure out how to conduct a short research and enough help to understand the industry and people with skills.

Leetcode 532 K-diff pairs in an array (III)

Sept. 8, 2017

It is so big surprise to watch how the peer performed the algorithm, I had a mocking interview on 10:00 pm. So, here is the C++ code to study. The peer is top 30% ranking on,  Contest rating: 2023 (max. candidate master, 2123). 

Leetcode 532 K-diff pairs in an array (II)

Sept. 8, 2017

Based on the mocking practice, I spent around 20 - 30 minutes to work out the solution to pass Leetcode online judge.

Here is the C# code.

Leetcode 532 K-diff pairs (I)

Sept. 7, 2017

It is the easy algorithm but it is very interesting to solve the problem through mocking practice.

Here is C# code I wrote.

Through the mocking practice, I did work on a test case and then demonstrated that the solution is working fine.

Past practice

Here is the practice on April 29, 2017.

Wednesday, September 6, 2017

C# courses on

Sept. 6, 2017

Plan to take courses related to C# on It is always better to spend time to learn first, and then figure out how to shorten time to develop the software. Believe that a more educated C# programmer knows how to write quality code with less bug and more readable code.

C# courses' link is here.

What great .NET developer ought to know

Sept. 6, 2017

Plan to read the article "What great .NET developer ought to know".

C# tutorial

Sept. 6, 2017


It is never too late to read a C# tutorial. Today I spent over one hour to read C# tutorial, and then I read the first time about C# reference types. There are four types which are class types, interface types, array types, and delegate types.

C# tutorial 

Plan to spend 30 minutes a time to read the tutorial. Write down new concepts here. Try to go over the tutorial in September.


Read page 1 and look into the declaration "C# is a simple, mordern, object-oritented, and type-safe programming language."

Plan to look into the keyword: type-safe programming language C# -

15 minutes read:

"Learn C# tutorials", the article link is here.


Read page 1 arguments:

"The type-safe design of the language makes it impossible to read from uninitialized variables, to index arrays beyond their bounds, or to perform unchecked type casts."


- uninitialized variables - how the design make default initialization in C#
- index arrays beyond their bounds -
- unchecked type cast - what is the unchecked type cast?

Look into type-safe design of C#, name three of them.

Each common mistake plan to read 5 minutes.
Buggy C# code: The 10 most common mistakes that C# developers make -

C5 Generic Collection Library for C# and LCI - the github link is

Read page 1 argument:

"C# Has a Unified Type System. All C# types, including primitive types such as int and double, inherit from a single root object type. Thus, all types share a set of common operations, and values of any type can be stored, transported, and operated upon in a consistent manner. Furthermore, C# supports both user-defined reference types and value types, allowing dynamic allocation of objects as well as in-line storage of lightweight structures.".

Google on this, and then come cross the result: #950 – C# Has a Unified Type System

Plan to go over 2000 things 30 minutes a time. Write down my favorite learning here.

2,000 things you should know about C#, the link is

Monte Carlo algorithm

Sept 6, 2017


It is the exciting time to share my knowledge about the Monte Carlo algorithm and how to apply to the daily life. The summer is the great time to hang out with a friend and then walk around the blocks, chatting is kind of art and science. I like to use the algorithm to help a young grudate to understand how to find the best boyfriend, theoretically how to do it.

For example, you will meet 10 candidates in next 12 months, at the end of 12 months, recall who is the best one in the last 12 months. And then, whenever someone shows up and beats the best one in last 12 months, it is a good idea to look into more.

Monte Carlo Algorithm

It is better to read the algorithm through wiki article first. Plan to read 10 - 20 minutes. Write down things I learn through the reading.

Binary search

Sept. 6, 2017


It is so interesting to write a binary search algorithm. First 5 writing I found out the issue every time, edge cases like middle value expression to avoid overflow, less and equal case. This time I found out a new issue, verbose code. How can I solve the issue?

Algorithm practice

C# practice is here.

Leetcode 37: Sudoku solver

Sept. 6, 2017


It is so enjoyable to write sudoku solver as a depth first solution and also walk through each step called "thinking out loud". The conversation after the mocking this evening starting from 10:00 pm until 11:30 pm is also rewarding experience, I try to contribute my two cents for a young person to prepare for an important trial. Although I have written sudoku solver solution over 5 times last 3 months, I still found that this time I wrote a different style.

Algorithm practice 

Here is my C# practice. No bug in the first writing, only fix two compiler errors, pass all test cases the first time.

I forgot that I need to visit current node instead of using two loops to scan the matrix to find the first empty element. After 1 - 2 minutes, I noticed the issue, and then I corrected my thought process and continue to write from line 25.

I wrote line 38 and thought out loud saying that it is kind of stupid to write '1', '2' to '9', actually I am thinking that it is better to split from string "123456789" instead of declaring a char array.

After the mocking interview 

I spent over 20 minutes to share my past 80 interviews with the peer, what I have learned through the mocking practice, specially how I learn to write sudoku algorithm through more than three practices.

One thing I like to say is that if you take it slow, you have a lot of time to write code in 30 minutes mocking interview; but if you write in a rush, then you end up with issues. I am getting more comfortable to stay on one node at a time.

The fact is that in my solution there is no need to write a double for loop at all. Avoid scan from top to down by row, left to right by column to find the first empty element all the time.

The peer gave me the feedback saying that I did very good to explain the algorithm by going over the example to find options 1, 2, 4, 7 ( see line 117 - line 124).

Monday, September 4, 2017

I'm proud. I did my best

Sept. 4, 2017


It is the big lesson I have to learn as a tennis fan. I have to learn how Sharapova handled her loss in the fourth round of US open 2017. I like to write down some notes from the interview.

9 minutes 32 second videos, "I'm proud. I did my best", the video is here.

Am I biased?

Sept. 4, 2017


It is the eighth year I am in the city of Vancouver, through all kinds of events I know most of software companies in downtown of Vancouver, I went to open house and other activities, I have been to  Vision Critical, BuildDirect, Microsoft, Amazon, Unbounce, the name goes on. But today it is the first time I spent over 30 minutes to do a research on through linkedin. The only reason I had my research for the long weekend is that I saw one of my friends to wear Vancouver Sun Run T-shirt with company logo -

So, my research of 20 minutes is that am I biased on the research of local industry?

Research on Linkedin

I have to admit that Linkedin is a really great place to do some research on career movement, how people advance their career, share their interest related to the technology, how they get their great strength from formal/ informal education.

A list of people I look into for my small research this long weekend is here, those people I had met in Florida, New York area, some of them I have not yet met.

I did a lot of study on tennis players this morning. Specially I watched the interview "I'm proud. I did my best" after Sharapova stopped on her fourth round in US open 2017. But it is also very interesting to know how my linkedin circle people move around and I try to figure out something.

Two people I knew moved to Google recently, tracy and ying.

First, I have to spend 10  minutes to study the website

Plan to study product management of the company, study one profile here.

Plan to study technologies used for the website, study one of managers' profile here.

Actionable Items

I do not plan to do the research on this morning, I was thinking to work on sponsor application paper work instead, and I actually did spend over one hours to study tennis players for top 8 players, and also did study the algorithm Leetcode 230 for one hour. All those activites ended around 11:00 am.

Sunday, September 3, 2017

My first android phone

Sept 3, 2017

I have to plan to get a new mobile phone for my coming china trip starting from Oct. 4, 2017. My first android phone was not able to start after the hiking trip, and I need a unlocked phone to travel in China.

I have the phone with me last 2 years. I bought the Nexus 5 used phone from crystal mall in Burnaby, and it is refurbished one. The phone's camera stopped working from January 2017 and it stopped to boot up starting from Sept. 3 after soaking with water. I used to have iphone 4S, and then I got complained about mobile website design issue, I usually used the simulated mobile device underneath google browser. I need to get to know various mobile devices at work, I got an iphone 6 for testing at work starting February 2017, and also it was good experience to experience Android device.

I found one, and I like to choose a used one. Bet on and its partner JP mobiles.
Samsung phone on, Samsung Galaxy S6 32GB smartphone - Sapphire Black - Unlocked - Certified Pre-owned - online only. Here is the link. The price is around $394.95.

Research and Study

It is the first time I brought up a discussion how to do shopping research with a graduate from university of Victoria linguistic major, I was amazed how my friend did good research and what good conversation we had on the search of products, comparison with different products over 30 minutes.

I was always teased by a friend that "we are getting old, young people are taking over". It is true that I have great time to learn and see how my friend with linguistic major demonstrated her thought process. One thing I like to say that the education she got is great. She learns most critical skills, analyze and learning abilities.

Be a outlier

I did some study on the course: be an outlier, the main idea is to be slack financially, one of ideas is to buy used ones. In order to practice those rules learned from the course, I like to apply my mobile phone purchase in a week.

Funny Story

I did some study this morning 9/4/2017 10:30 am labor day long weekend on on linkedin, and then I was surprised that the samsung phone on I did research shows up. And I did study tennis player Sharapova on, the walmart phone I did study also showed up. Unbelievable advertisement, I was followed everywhere.

Follow up

I got the phone, and started to read the tips to use the phone.

The article is here about a few tips.

Darren Cahill as a tennis coach

Sept. 3, 2017

Plan to do some research on the coach. Watch the video a few times, write down some notes about a top coach and how he thinks as a coach. The 3 minutes video is here.

Leetcode 230: Kth Smallest Element in a BST

September 3, 2017


It is the great learning experience to watch a 2nd undergraduate student to perform the algorithm. The peer did very well on the analysis, but the execution of the algorithm is kind of weak. I need to step in and ask a good question about the iterative solution.


This is the first time I show my evaluation as an interviewer. It is such a great activity that I meet a new person and also help the peer to learn an algorithm.

I still remembered that back to 2006 I applied the instructor job in united states, I was afraid to write and speak out, and I did send out over 20 applications.

Now it is so natural to watch how an undergraduate learns the algorithm through various channels outside the university. And I am glad to be part of the process.

Learn an algorithm called Leetcode 230. Also match the algorithm with great reward experience to be part of mocking interview.

Here is the review I got after the mocking interview:

Actionable Item

After the mocking interview, I felt that the peer is not very competitive player. But I learned through his analysis, his calmness and his idea to continue to search right node for bigger value in order to get largest one is very clear and correct. 

I felt pressured that second year undergraduate student will master the algorithm in such a quick pace, how I should do in order to compete? Just be their friends. 

Next time I should copy the peer's code, and analyze the code later. 

Leetcode 54: Spiral Matrix

Sept. 3, 2017


It is the classical medium level algorithm to write spiral matrix in one dimensional array. I have practiced more than 3 times. The key idea is to go over the four iterations from top row, last column, last row and first column, edge cases are one row or one column. last row and first column is optional because they are handled only if there are more than one row or more than two columns.

Compared to the practice in March of 2016, I am so happy to see that I can write more readable code.

Algorithm practice 

C# code is here


Summer 2017

Sept. 3, 2017


It is the early morning, after 8 hours hiking, I went to bed early and ended up to get up around 3:30am, now it is 5:30am, I decided to write a blog called "A programmer is seasonal?". I am trying to do a small research how the summer activities enriches a programmer's life living in the city of Vancouver, I may be able to perform better as a software programmer.

I decided to go out hiking last Saturday once I got the invitation. I had a busy week, I started to use github account to track my source code progress, I also evaluated the ransom virus and build a working environment on a new hard disk since the virus encrypted all files in my old computer.

Source control 

One thing I did and also very helpful is that I print out the code I rewrote, code review and put them on paper. So, it was so good to read the code on those papers when I found out a few pages code lost in the shuffle of version control, server and local hard disk. I just found out so many weakest points to review my working procedures. I can be better and powered with so many tools.

Try to address a few issues based on facts:

1. It is easy to catch up the technologies these days. I just started to use github version control less than one month ago. There are so many advanced features of github, it is also exciting to learn some advanced features.

3. I have more activities to go out with friends in the summer last few weekends. I had a trip to Vancouver island, hiking with friends, friends from California visited the city of Vancouver. Those activities makes a programmer more happy.

4. One more research in summer is what if I decide to lose 10 or 20 lbs. What should I change?

5. Now it is US open tennis 2 weeks. I learned a lot from those players, do those player help me to understand better the competition in the market about talent, what should I do to take advantage of it? I want to be strong and more competitive programmer.

Actionable Items

Need to figure out how to make this small blog more organized, readable. Figure out 2 or 3 ideas to work on.

Golden ear canyon loop hiking

Sept. 3, 2017

It is the long day Sept. 2, 2017. I took 8 hours hiking with group of 10 people in Willingdon church small group. The trail link is here.

We started from the parking lot of trail from 10:00 am, and finished the end of trail around 6:00 pm. I could not believe that I handled the hiking very well even though I could not handle the steep upward trail under sun very well.

It is the beautiful day and let us present great picture to show that a coding blog can also be well presented with beautiful scenic view. Wish a good programmer can benefit from the outdoor activities and enjoy the friendship and some sports.

I went to bed around 10:00 pm and woke up 3:30 am in Sept. 3, 2017, and now it is 5:30 am, I am planning to book a mocking interview at 10:00 am, and then thought about how to relax my legs to relieve the stress caused by long hours walk.

Friday, September 1, 2017

Sponsor application

Sept. 1, 2017


It was the second time I mailed out the application forms to Canadian immigration processing center, I mailed out on August 10, and then I got a letter about missing signature on August 27 and all my application files were returned.

I plan to review the application documents again, and plan to mail out this long weekend.

10 things about web.config inheritance and overrides

Sept. 1, 2017

It is the great experience to spend two hours to study ASP.NET. I started with the article called "10 thins ASP.Net developers should know about web.config inheritance and overrides".

Thursday, August 31, 2017

Leetcode 4 sum

August 31, 2017

Plan to continue to work on 4 sum solution, using hashtable to store all possible two sum, and then look for 4 elements with the given sum. I chose to write the solution instead of using a two for loop for the first two elements, and then two pointer technique to find a sum value. This is the first time I wrote the idea and I like the adventure.

30 minutes practice code is here.

In the mocking practice, I explained to the peer that I have to write a function to determine that 4 indexes are unique. In other words, assume that 4 indexes are a, b, c, d, then at least 4 comparisons are needed, a != c, a != d, b != c, b != d. Actually there are a lot of duplicated pairs for a < b < c < d four numbers to a given sum, (a, b) and (c, d) are two pairs with sum a + b + c + d, or (a, c) and (b, d)  with the same sum, etc., to simplify, we can enforce that the pairs to look for are (a, b) and (c, d) only.

I thought that it will take a few minutes to write the logic, and gave up the writing in the mocking. Since in the mocking interview, I was not sure that I should simplify the search, enforce the rule to apply a < b < c < d, therefore the checking will be very simple as b < c, in other words, the second element in the first pair is smaller than the first element in the second pair.


The C# code passes all test case, I did fix the grammar error, and also simplify the search. I try to search two pairs in the ascending order. First sort the array, and then iterate any pair less and equal half the given value, find another pair with index of array (start, end), the start index is bigger than the pair's second argument's index.

C# code is here. Last practice is on April, 2017, the blog is here.

A very competitive peer 

A few things I learned from the peer. If I am the interviewer, I should explain the problem to the interviewee, and then let interviewee ask questions to clarify the problem. I do not explain the algorithm to the peer when I am the interviewer, but this time the peer asked me to explain the algorithm at the very beginning, and I was told that I should explain the problem as the normal interviewer does.

The fact is that only two or three peers out of 80 mocking experience did explain the algorithm to me at the beginning. Now I knew that it should be always the case.

Do not just let the interviewee to read the problem statement and then figure out the algorithm.

Try to simplify the algorithm, otherwise I cannot finish it in 30 minutes. The peer thought that it is better to have a working solution instead of having a solution not completed.

Write test cases by yourself first, instead of using "Run tests" feature embedded in the browser.


Leetcode 10 - regular expression matching

August 31, 2017


It is my most favorite algorithm in 2017 called regular expression matching. I spent over 20 hours and over 3 months to work on the solution, and today I met a peer through mocking. And the peer showed me to solve the algorithm using dynamic programming, pass all test cases. Amazing talent!

Algorithm practice 

Here is Java code for me to study using dynamic programming. I watched the performance in 30 minutes meanwhile I went over my previous practice using dynamic programming code as well.

I did ask a few questions about the design.

Wednesday, August 30, 2017

No Shows offensive actions

August 29, 2017


It is the second day to practice 10:00 pm mocking practice, I made a mistake and fell sleep around 9:20 pm and woke up at 10:10 pm. I just made an offensive action called "No show".

It is the first time I made a mistake through past 20 interviews. I got very good rating 4.6 out of 5 stats, reputation score: 100 points, No Shows: 1.

Here is the graph to document my achievement:

I highlighted the score I got for 5 out of 7 stars, I still had score on talk with ranking 5. Hack, craft and talk 3 categories I got ranking 5. What should I do to improve and get rid of those 5. I believe that if I do give good advice and code review, the peer will appreciate my help and reward me the good ranking, therefore I can meet the strong player as my next practice. The hard I work on the current peer, the more rewarding is down the road.

After 30 mocking practice, I have to get back to build up my credit and meet strongest players in mocking practice.

Algorithm learning 

I did learn an algorithm and practice Leetcode 532The C# code in practice has a few issues, and the code was updated with a few changes in order to pass all test cases. The code is here.

Based on C# code standard, the practice I did fixed the issue in my last practice, the rule should be followed. The rule is called "Do not change a loop variable inside a for loop block".   

Actionable Items

Plan to remember C# coding standards all rules one by one. 

Catalan number

August 30, 2017


It is the classical algorithm and also I like to practice again and again. It is called Catalan number. When I am tired, my brain stops working partially but I do not know which part. Today, I had a mocking practice starting from 10:00 pm, and I was very tired after one day coding at work, and then I asked the peer which one is row and which is column. I looked at the graph and I did not know where the row is. The peer told me that row should be horizontal. You see, when I am tired, I still can tell quickly the horizontal and vertical, but I could not tell which is row and column. I have to ask the peer and get some assumption based on the common sense.

I practiced the algorithm before more than once, one time I was the interviewer and one time I was the interviewee.


Here is C# practice. I wrote the code to pass all test cases in my first writing.

Actionable Items

Try to figure out the tough situation, when I am tired and physical sleepy, after one day work, 10:00 pm, what is my best strategy to work with peers to solve data structure and algorithm problems.

Yesterday I booked 10:00 pm mocking, but at 9:30 pm, I laid on bed to read wechat and fell asleep, when I woke up, it was 10:10 pm, I missed the mocking practice.

Never lay down and I should sit up and keep myself wake until 10:00 pm.

Top 100 C# interview questions

August 30, 2017

Plan to study those websites about C# questions. It may be a good idea to start a day to learn C# as a programming language.

I like to invent some ways to get more motivated to go over those C# interview questions. Here is the blog.

Plan to write down  a few keywords to learn, mark it a first time/ second time/ x times to learn.

10 steps to master C# programming (I)

August 30, 2017


Recently I was asked to evaluate how good I am in C# using ranking from one to ten, I actually give myself 7 if six is the minimum level to play C# as a professional. I do have a lot of chance to learn C# programming language last 7 years full time work, but I never set up a goal to work on C# programming as highest priority.

C# coding standard

Plan to read C# coding standard, and the C# coding standard with examples I got from the course study on

Plan to read 36 pages Aviva Solution coding guideline for C# 3.0, 4.0 and 5.0. The link is here.

My favorite learning time (30 minutes in 8/31/2017) is to read the C# object and collection initializers. The link is here.

Teach Yourself Programming in Ten Years - Peter Norvig

August 30, 2017


It is the first time I read the article about 10 years to learn programming. I did the course "Become an outlier: Reprogramming the developer's mind" study on, and then I chose to study one of arguments in the course.

Monday, August 28, 2017

Recursive solution - Julia's most favorite game

August 28, 2017


Recursive function is my most favorite game as a software developer starting from 8/28/2017 10:00 pm. I think that I reach the threshold of number of failures, and then today I had great experience to write a recursive function. 

It is hard for me to find the time to practice mocking interview in August. I was busy to catch up so many things in August, vacation, outdoor activities like tennis, walking after dinner, so in August 2017, I only practice six mocking interviews so far. Today I like to go back to mocking interview and choose 10:00 pm instead of 8:00 pm. I only had two mocking experiences using 10:00 pm.

Algorithm practice 

Here is my C# practice code, the code passes all test cases, in 30 minutes limit. The peer type two wow to express the surprise, excellent performance. The only thing was last 10 minutes the peer lost video connection, the peer typed the text to continue the process.

My last practice is documented here, and the C# code is here.

Highlights of issues:

1. How to handle edge case?
case 1: "a.b.c", last key should not be followed by the dot char
case 2: if the key is empty string, then dot char should be skipped.

line 36: design of variable newPrefix, first writing is newPrefix = key + ".".  The design has flaw, if the key is the last one, the dot char should not be concatenated.

It is 11:50 pm. I turned on the computer and then added some notes about the compile errors in my writing. Write down the compile error, and then work on type issue, in the next practice, I should not write any code on this algorithm with type compiler errors. I am really tired and sleepy.

The corrections are in three places:
1. Line 38, add Dictionary<string, object>
2. Line 45, add (string)

The advice I got from the peer:
1. Move static variable into the function, line 9;
2. Empty key should not be concatenated by dot char '.' by observing the last test case.

Actionable Item

It is very important skills to learn how to work with various levels of software programmer, I decide to reserve 10:00 pm as my mocking interview time every day. I believe that 10:00 pm is hard choice, too late and it takes extra work to get focus. It will be good choice to simulate tough situations in the work place.

Bible verse encourages me to work hard, specially when I am tired.

Github plan for developer

August 28, 2017

It is so important to catch up some skills to use github version control system. I subscribed the developer monthly plan $7 us dollar in last week of August, and then started to learn one thing a time using github.

Plan to write down the challenges and plan to study some courses on for a few hours.

Github for windows developer - the link is here.

Spice up learning interest, read the blog about codeplex saying goodbye. The article link is here.

Saturday, August 26, 2017

Vancouver Island vacation

August 26, 2017


It is a beautiful trip to visit Vancouver Island.  My best time is to take the ferry this morning to Victorias island from 1:00 pm, 90 mintes on the boat, and then spent a few hours in butcher garden, during 3 hours road trip to Nanaimo island Ramada Inn, beautiful viewpoint at top of mountain. We checked in around 10:00 pm.

I enjoyed so many things. It is the friend to remind me, we used to study in Florida, worked at Motorola from 2001 to 2002.

I did nother plan the vacation. All I had to do is to listen, and follow the instructions. Bible teaching is most efficient in my last 7 years, I still remembered that the elder washed my feet in the ceremony 4 years ago, in the small group I volunteered. The small group taught us how to be leaders, serve others with humble spirit.

Tuesday, August 22, 2017

Ransom ware attacks

August 22, 2017


It is so busy to work on a few things recently that I did not catch up update about most popular virus and attacks more than 6 months. Today I like to catch up and spend one or two hours to get educated.

It is the first time in the summer to go home around 1:00 pm, it was so hot to drive to home. I am staying at home and like to choose the topic for my research.

Attacks and virus

Plan to read the virus article called "Ransom ware attacks".

Plan to read another article called "WannaCry ransomware: What you need to know". The link is here.

Plan to watch 30 minutes video called "Q&A: WannaCry ransomware attack with Mattew Braga".

This is a video to explain in detail about the attack, called "Wana DecryptOr (Wanacry Ransomware) - Computerphile".

Microsoft update on the virus - the link is here.

Actionable Items

It is never too late to purchase a github business account. 

Top 5 free hosted version control sites compared - the link is here.

Monday, August 21, 2017

Merge Sort Tree and Persistence in Data Structures

August 21, 2017

Plan to spend 1 hours 20 minutes to watch the lecture video. 

Lecture 1 : Persistence segment tree with its applications and merge sort tree. By Sergey Kulik.

The lecture video is here, 1 hour 23 minutes. 

Need to go over the merge sort tree tutorial first, the link is here

Snackdown training camp

August 21, 2017


It is the first time to look into the training camp. The lecturers are the top players of competitive players. The link is here.

Lecture 1 : Persistence segment tree with its applications and merge sort tree. By Sergey Kulik.

The lecture video is here, 1 hour 23 minutes. 

Sunday, August 20, 2017

A competitive programmer

August 20, 2017


Now it is 10:45 pm in the Sunday evening. I like to spend 20 - 30 minutes to do a small research, and write a blog about it as well.

How to train myself to be a competitive programmer?  I spent over 90 minutes this morning to go over a talk and plan to learn an algorithm, the blog is Square root decomposition in competitive programming, and the algorithm is called Mo's algorithm.

I played the codesprint yesterday, and my ranking is 2900 out of 9000 players. I solved one easy two medium algorithms. There are three hard level algorithms in the codesprint, I will practice after the contest in the weekdays.

I can talk about a lot of things, but let me share my reading about this post "How Anudeep Nekkanti answers the question to rank 35th in the world through 6 to 7 months training?".

Plan to read more answers from Miguel Oliveira.
Read Egor Suvorov.

Invariant explanation is short and clear: (Julia's ranking 10 out of 10)

6 months to prepare for facebook/ google's algorithm problem solving?

Plan to watch the videos, the link is here

Transaction Certificates - Goldman Sachs Codesprint

August 20, 2017


Summer is here in the city of Vancouver. One of entertainment is to get involved with the contest, and learn some hard level algorithm. This algorithm is related to rolling hash, and I think that it is great to warm up hash function, and taste the problem solving using rolling hash as well

So excited to play something, and get my hands dirty on the code, and feel so busy for a few hours. There are 594 submissions in the contest, score 60.

I like rolling hash.

Algorithm study 

Currencies - Goldman Sachs Codesprint

August 20, 2017


It is the first hard level algorithm. I did not spend time to read the problem statement in the contest. There are 1452 submissions, I like to get connected with those talents, one thing I can do is to study the algorithm, and find some C# solution, and then share my review here.

Algorithm study 

The problem statement is here. Plan to spend 30 minutes to read the problem statement first. 

Square root decomposition Algorithm

August 20, 2017

Plan to study the algorithm called square root decomposition. Choose to read the following blogs:

Codeforce blog about the algorithm's link is here.

First, I need to understand the algorithm by going over the geeksforgeeks blog. The link is here.

Square root decomposition in competitive programming

August 20, 2017

Watch the video 1 hour 44 minutes, the video link is "Square Root Decomposition in Competitive Programming".

Anudeep Nekkanti was a googler who presents the talk.

I spent time to go over all the questions he answers on while listening to the video.

A lot of questions and answers about competitive programming and intern, and other things.

45:00/ 1:44:40
Question: How to code fast?

He talked about how to write code, the expert writes the code slow, white board testing. Compared to write code first, and then spent time on debugging. The expert chooses the first choice. Debugging takes a lot of time.

Be accurate, be more thoughtful, it is not the typing fast.

47:11 / 1:44:40
Google interviewer even does not understand your code. He keeps saying, check your code 5 minutes, make sure that everything is correct.

50:14 / 1:44:40

Google interviewer tried to see how you solve the problem.

1:12 talk about the algorithm and then give some examples:

Unbelievable, I finished the video at 1:02 pm. It took me over 110 minutes. Last 30 minutes, the presenter gave talks about algorithms related to square root decomposition, like Mo's algorithm.

Minimum Cost algorithm warmup

August 20, 2017

I reviewed the algorithm called minimum cost on Hackerrank in order to prepare for an algorithm in Gold Sachs codesprint.

I spent over 30 minutes to go over the test case. Here are the detail.

            var prices = new Int64[] { 20, 7, 8, 2, 5 };
            var minimumLoss = calculateMinimumLoss(5, prices);

Purchase at price 7, sell at price 5, and the minimum loss is 2.
Go over the test case, and get hands dirty on this test case:

Walk through the test case, backward iterate the array, and add element one by one to the SortedSet object called sortedSet.

First, sortedSet is empty, visit 5, search sortedSet a binary search tree for value from [5 - minLoss + 1, 4], empty set is found. Add 5 to SortedSet object.

Next, visit the element 2, and then search [2 - minLoss + 1, 1], empty set is found. Add 2 to SortedSet object.

Third, visit the element 8, and then search [8 - minLoss + 1, 7], find {2, 5}, get max value 5, then the loss is 3. Minimum loss is updated to 3. Add 8 to SortedSet object.

Fourth, visit the element 7, and then search [7 - 3 + 1, 6], in other words, [5, 6], 5 is found, and then, minimum loss is updated to 2.

Here is the C# code.

Saturday, August 19, 2017

Time Series Queries - Goldman Sachs CodeSprint

August 19, 2017

Plan to work on the hard level algorithm called "Time Series Queries". The problem statement is here.

Try to use binary search tree related data structure in C#, SortedSet.

10:07 pm
Review "Shorted Job First" using SortedSet. The blog link and last practice is here.

10:32 pm
Review Hackerrank - woman codesprint minimum cost. The code review link is here.

11:15 pm
Warm up the algorithm using SortedSet with a test case. The warmup code is here.

Stop here at 11:41 pm, and get up 6:00 am, work another 3 hours for the algorithm. Morning time is better for the hard work.

Data structure design, what is needed to expedite the search? First is to find the time, using binary search is better than linear scan. And need to find the first one with value bigger than the given value.

Need to pre-process the data and then the data are stored to fit for the queries.

6:00 am
Wake up. Thought about the algorithm but my idea to find kth larger one has timeout issue. Could not find the correct data structure to handle, went through heap, linked list, space concern etc. Continue to sleep. Set timer for 30 minutes

6:30 am

7:00 am

8:00 am
Only one hour left, I had hard time to get up. So good sleep. I could not come out the pre-processing idea.

9:01 am
The contest ended at 9:00 am. Check editorial note, haha, so easy. My sleep therapy with a problem solving did not work, I did not choose to stay late in the morning for my health concern.

I tried to change the style to define a good fight for this hard algorithm. At first, I choose the good night sleep, wait for the inspiration through the sleep and thinking.

Get up around 9:10 am, talked to the friend about next weekend Vancouver island road trip. I delayed the discussion in Saturday night 9:30 pm, told the friend my contest ended in the morning 9:00 am.


I have to train my brain with hard level algorithm. I am getting lazy with brain storming. Work hard!

Actionable Items:

Need to work on better logistics for codesprint. Friday night I should have started the codesprint, but I spent over 2 hours to book a hotel, and then I spent time to study,, websites.

Saturday morning 10:00 am - 12:00 pm I visited a burnaby church, and were very interested in the structure of the service.

Trader Profit - Goldman Sachs Codesprint

August 19, 2017

Plan to work on the medium level algorithm called Trader Profit. The link is here.

Now it is 5:43 pm, 15 hours left for the contest to Monday morning 9:00 am.

It is 7:19 pm. The algorithm is solved and then ranking is 2414.

Note after the contest 

I reviewed Leetcode 121, 122, 123 algorithms, and then used Leetcode 123 algorithm solution, my last practice to submit the code.

I did read the solution for Leetcode 121. The link is here. I also read the solution for Leetcode 122, the link is here.

Things found in the contest

I found issues in the contest, when I reviewed my practice of Leetcode 121 and Leetcode 122 in the contest, I found out that my blogs does not have anything, only source code code link. In order to understand the algorithms, I have to lookup Leetcode discussion. My last practice does not help me at all.


A hard working programmer should be diligent to write down more helpful notes for herself to use next time in the contest.

Here are the links of my last practice.

Leetcode 121 link is here.

Leetcode 122 link is here.

C# Code submitted in the contest is here.

Wimbledon Champion Garbiñe Muguruza (Full Interview)

August 19, 2017

Watch the video Wimbledon Champion Garbine Muguruza.  7 minute video link is here.

1:45 Beat Serena?  They are tough opponent.

2:15 Superstition?  Be confident. Very nervous, shaking. 2 years ago I lost. This one is mine. Trying so hard to win.

2:27 Feel nervous? Once you get to the court, you are sweating. When you get there, you are good there. The best is that crowd is equal.

4:20 How to celebrate? kind of lost here.


Inspiring Stories: Garbine Muguruza

August 19, 2017

Watch less than 3 minutes videos about an inspiring stories: Garbine Muguruza.

Plan to write down some notes, what are the key points in the story. How the video is presented? The gentle voice and the story about going to No. 1 in the world, young player age 23.

0:00 To be the best player at the top, you have to be very demanding. Everything you do has to be perfect. It is very demanding. There is no room for imperfection. I love to compete, so be able to go out there, have an opponent in front of me, it makes me hanging there to win.

0:25  It is a game, I have to earn my victory.

1:11/ 2:28 Try so hard, and play without fear, and just give it all.

1:26/ 2:28 Focus on the match, forget about where are you. Concentrate what you have to do.

1:51 I feel that you like to do something, you just go for it. For me, it is to play tennis, be the best I can.

By Maximum Stocks - Goldman Sachs Codesprint

August 19, 2017

Plan to work on the medium level algorithm called "Buy maximum stocks".

I started to work on the algorithm from 3:37 pm, and solved the problem at 5:32 pm.

Plan to go back to study string.Split function StringSplitOptions Enumeration. The msdn link is here.

Here is the progress report. I took 36 minutes to review the code, and fixed bugs, and then read one of discussions to get the bug fixed, solved all test cases from 1 to last one run time error issue.

Now the ranking moved from 7xxx to 4xxx. Good job!

Follow up 

Code submitted in the contest is here.