January 22, 2017
Introduction
Julia chose to study 13 questions posted by Gilad, reputation over 700. (the link is here), she came cross the code review: Finding overlapping time intervals. So, she likes to relate to her own practice. She did some work on Leetcode 56: Merge Interval, so she investigated how her practice was. One fact is that she had not made any submission through leetcode online judge on the algorithm. Her practice was too closed and had zero impact, and she decided to make changes this time.
Workout
Julia's C# practice, code is here.
Highlights of practice:
1. Julia studied the Java code, and then tried to figure out how to write a C# comparator. She figure out that it is better to use LINQ instead of comparator. She studies the post on stackoverflow.com.
2. Julia tried Leetcode online judge, first test case failed, when the intervals has only one interval. And then, Julia added edge case. line 92 - 93.
3. Julia submitted Leetcode online judge again, failed test case: two intervals, [1,4], [0,4], the merged interval should [0,4], not [1,4]. Forgot to use sortedIntervals, instead of using intervals. How to avoid this kind of writing issue.
Code review on stackexchange.com, link is here.
January 23, 2017
Code review is here; and C# code is here. She got 7 up-votes and 3 answers in less than 24 hours.
A new study
1. Study C# code review completed by Nick Udell, review link is here.
2. Study tag - inteval questions, review link is here.
From January 2015, she started to practice leetcode questions; she trains herself to stay focus, develops "muscle" memory when she practices those questions one by one. 2015年初, Julia开始参与做Leetcode, 开通自己第一个博客. 刷Leet code的题目, 她看了很多的代码, 每个人那学一点, 也开通Github, 发表自己的代码, 尝试写自己的一些体会. She learns from her favorite sports – tennis, 10,000 serves practice builds up good memory for a great serve. Just keep going. Hard work beats talent when talent fails to work hard.
Sunday, January 22, 2017
Code review - convert tree to list
January 22, 2017
Study the code review -
Study the code review -
Tree traversal into List
First review, link is here.
Second review, link is here.
Work out
Write C# for each review as well.
First review, Julia's C# practice. Code is here.
Second review using IEnumerable, Julia's C# practice. Code is here.
Second review using IEnumerable, Julia's C# practice. Code is here.
Saturday, January 21, 2017
Code Monk - Disjoint set union (Union find)
January 21, 2017
Julia got an email about the disjoint set union, and also she registered the test.
Basics of data structure - disjoint union set on hackerearth - a tutorial. Read the tutorial more than 30 minutes from 10:00am - 10:30am, Saturday, January 21, 2017.
Introduction
Finally, Julia found out some lecture note to help her think clearly, after more than 6 months, please see my previous blog - Roads in the Hacker land, word code sprint #4; over a few hours study, code review on Value of friendship, Julia worked on UnionSet class code review, blog link is here.
Code with unit test cases, study first (ID: yambe2002, ranking: 111/10432), link is here. Code review, link is here.
Hackerearth tutorial is well-prepared notes. So enjoyable to read the notes.
Workout plan
Julia understood that her time is limited, and also she pushes herself to attend contests as many as possible, try to put herself on constant pressure, therefore, she can perform better in the matches and also at work.
But, it also is important to get involved with others through community. She just noticed the difference since Nov. 25, 2016 when she joined the code review on stackexchange.com. It does not matter how many hours Julia dedicated herself to study one algorithm, she just needs to spend extra one hour to share with the community, people can benefit from her work, meanwhile she can get some feedback as well. As long as she continues to build credit and reputation on her work through the code review on stackexchange.com, she should enjoy learning process. Julia is no longer a lone worker, she learns to work better with others in the community.
Post the algorithm "value of friendship" question on code review website, link is here.
Study 13 questions posted by the user, reputation over 700, link is here.
Julia got an email about the disjoint set union, and also she registered the test.
Basics of data structure - disjoint union set on hackerearth - a tutorial. Read the tutorial more than 30 minutes from 10:00am - 10:30am, Saturday, January 21, 2017.
Introduction
Finally, Julia found out some lecture note to help her think clearly, after more than 6 months, please see my previous blog - Roads in the Hacker land, word code sprint #4; over a few hours study, code review on Value of friendship, Julia worked on UnionSet class code review, blog link is here.
Code with unit test cases, study first (ID: yambe2002, ranking: 111/10432), link is here. Code review, link is here.
Hackerearth tutorial is well-prepared notes. So enjoyable to read the notes.
Workout plan
Julia understood that her time is limited, and also she pushes herself to attend contests as many as possible, try to put herself on constant pressure, therefore, she can perform better in the matches and also at work.
But, it also is important to get involved with others through community. She just noticed the difference since Nov. 25, 2016 when she joined the code review on stackexchange.com. It does not matter how many hours Julia dedicated herself to study one algorithm, she just needs to spend extra one hour to share with the community, people can benefit from her work, meanwhile she can get some feedback as well. As long as she continues to build credit and reputation on her work through the code review on stackexchange.com, she should enjoy learning process. Julia is no longer a lone worker, she learns to work better with others in the community.
Post the algorithm "value of friendship" question on code review website, link is here.
Study 13 questions posted by the user, reputation over 700, link is here.
Thursday, January 19, 2017
Union-find lecture note study
January 19, 2016
Julia spent a few hours to work on the algorithm "Value of friendship" code review using union-find algorithm. She needs to go back to basics, read some lecture notes as well.
Code with unit test cases, study first (ID: yambe2002, ranking: 111/10432), link is here. Code review, link is here.
She found one for her to read - one or 2 hours, after that she will go back to read more C# code.
Lecture notes - Union-find.
Write down some notes to help yourself to understand better in theory. Algorithm is not just to write a program, also need to understand the problem more thoroughly.
Actionable Items:
Julia had some difficulty to understand the union-find algorithm, therefore, she moved on her next search, not by Google.
Julia spent a few hours to work on the algorithm "Value of friendship" code review using union-find algorithm. She needs to go back to basics, read some lecture notes as well.
Code with unit test cases, study first (ID: yambe2002, ranking: 111/10432), link is here. Code review, link is here.
She found one for her to read - one or 2 hours, after that she will go back to read more C# code.
Lecture notes - Union-find.
Write down some notes to help yourself to understand better in theory. Algorithm is not just to write a program, also need to understand the problem more thoroughly.
Actionable Items:
Julia had some difficulty to understand the union-find algorithm, therefore, she moved on her next search, not by Google.
Wednesday, January 18, 2017
Linkedin connection study
January 18, 2017
Introduction
Julia took 2 hour to go over her linkedin connections - 820 connections, and then she finished to review all of them. A lot of surprises, and then she was amazed that she had experience to work with so many people before, now some of them are really doing very well. It is the beginning of the year 2017 and it is also good time to see how others are doing.
Study
Julia likes to have some numbers, a small statistics to share.
1. Two of her connections started to work for Amazon in the middle of 2016. Two are her Florida friends back to year 2000.
2. One of facebook engineer becomes an engineer manager. She knew him through Vancouver facebook tech talks. She learned to work hard, cannot depend on the luck. Those people working in facebook are really hard-working people as well.
3. One starts to be the principle engineer for auto industry research in 2016.
4. A few of new principle lead and principle engineer for HP, EMC in 2016. Those are her Florida Atlantic University's classmates.
Introduction
Julia took 2 hour to go over her linkedin connections - 820 connections, and then she finished to review all of them. A lot of surprises, and then she was amazed that she had experience to work with so many people before, now some of them are really doing very well. It is the beginning of the year 2017 and it is also good time to see how others are doing.
Study
Julia likes to have some numbers, a small statistics to share.
1. Two of her connections started to work for Amazon in the middle of 2016. Two are her Florida friends back to year 2000.
2. One of facebook engineer becomes an engineer manager. She knew him through Vancouver facebook tech talks. She learned to work hard, cannot depend on the luck. Those people working in facebook are really hard-working people as well.
3. One starts to be the principle engineer for auto industry research in 2016.
4. A few of new principle lead and principle engineer for HP, EMC in 2016. Those are her Florida Atlantic University's classmates.
SUCCESS
ISN'T JUST ABOUT
what you accomplish in your life
IT'S ABOUT
WHAT YOU INSPIRE
OTHERS TO DO
From carowozniacki, former No. 1 WTA player (Highest rank: No 1, 11 Oct. 2010)
Tuesday, January 17, 2017
Suffix Rotation - a test case tells the truth
January 17, 2017
Introduction
Julia
had some study on Leetcode 17 - a phone
number algorithm, one of studies is on stack/ queue
implementation of the algorithm in May 2016. After more than 6 months, in
January 2017, she worked on suffix
rotation algorithm in
the contest, she made a mistake to choose using queue instead of stack.
So,
after the week code 28 contest, in 1 - 2 day, she studied suffix rotation's
test case provided by hackerrank: a string "lcatqjejhpgkrkhnxsfyqlulncefeytykwnqbfmqaduldwhgwruwkdvojexefcmfrlfuzzcurjgnnbkskbzw",
the code has issues related to out-of-memory, queue size is over 11,387,997, 10
millions, stop after processing first 12 chars "aaabbbbbccc", over
one minute at least.
code
with bugs is here.
Suffix Rotation C# practice, with a bug running out of
memory.
Problem Solving
Thank
you, a small test case helps me to understand the issue again. Queue vs Stack,
for phone number less than 7 digits, queue is still ok - not causing
out-of-memory issue. But with string with length over 20, the problem quickly
comes out easily.
lcatqjejhpgkrkhnxsfyqlulncefeytykwnqbfmqaduldwhgwruwkdvojexefcmfrlfuzzcurjgnnbkskbzw
Remember this test case, as a programmer, Julia has to work on a test case more often; build a good habit to figure out issues in the design with help of test cases, specially in any hackerrank contest. Kind of boring talk, let us talk about a song.
The solid Rock, corner stone or sinking sand
Julia has a favorite song she likes to sing along a lot of times, specially a lot of years ago (2000 - 2010) in Boca Raton
Related to being a hackerrank contest player, Julia has some
hope, the test case can be her solid rock if she has weakness in the design, and flaws in thinking process.
The test case is the solid Rock, I stand;
All other ground is sinking sand,
All other ground is sinking sand.
Code review study
Julia chooses to study more on phone number related
algorithms.
1. Code review: Phone number.
2. Very good Dynamic programming explanation, read the phone
number's code review
by Google engineer.
3. Phone number code review - group of 3
digits with no lone digits.
At last, review algorithm code review made by a google engineer, click here.
CSS style sheet guidelines - study
January 17, 2017
Introduction
It is time to learn more about CSS at the beginning of 2017. Julia still remembered that a few years ago (maybe in 2012) she had to answer the question - what CSS stands for, actually she did not answer correctly. In 2013, she decided to spend 2 months to read "Head first html and CSS", and fell in love with solving the puzzles at the end of chapters, she spent over 20 hours to learn rule, specificity, box model, and then she studied all CSS selectors, and then she started to read CSS code like other language she likes. Learning a language takes some determination.
Always Julia learns one term a time, write down, practice, talk about or use it, and then come back to review them. This blog she will learn something about CSS and SOLID principles.
Study
Design for real life - click here.
Css style guidelines - a summary on CSS - tricks.
Read the article:
http://cssguidelin.es/
Great time to read single responsibility principle, how to apply .css class design. Read Open/close principle, how to apply to css class design. Read Writing DRYer vanilla CSS
Introduction
It is time to learn more about CSS at the beginning of 2017. Julia still remembered that a few years ago (maybe in 2012) she had to answer the question - what CSS stands for, actually she did not answer correctly. In 2013, she decided to spend 2 months to read "Head first html and CSS", and fell in love with solving the puzzles at the end of chapters, she spent over 20 hours to learn rule, specificity, box model, and then she studied all CSS selectors, and then she started to read CSS code like other language she likes. Learning a language takes some determination.
Always Julia learns one term a time, write down, practice, talk about or use it, and then come back to review them. This blog she will learn something about CSS and SOLID principles.
Study
Design for real life - click here.
Css style guidelines - a summary on CSS - tricks.
Read the article:
http://cssguidelin.es/
Great time to read single responsibility principle, how to apply .css class design. Read Open/close principle, how to apply to css class design. Read Writing DRYer vanilla CSS
Saturday, January 14, 2017
HackerRank - week code 28 - The value of friendship
January 14, 2017
The value of friendship - problem statement
In the contest
Read the discussion, and prepare to write some code.
Test case: 1 5 3 1 2 3 4 4
What about 1 5 3 1 2 3 4 4 5 Would the answer be 16?
Discussion is here.
Test case - 16
One more discussion is here.
example:
Disjoint set
Review the content on wiki.
Julia spent a few hours to read discussion, and did some research to see how people in top-ranking of content discuss and share their experience. Anything she needs to catch up.
She studied the profile:
Another one shared the advice of using disjoint set, here is the comparison to his contest:
After the contest
Need to practice a few of them.
Study a few submissions in C#, first one is here.
Code review one of C# submission, and work on a test case - a graph with five nodes, 4 connected friendship, 1-2-3 4-5, also 1 is friend of 3. 4 friendships, 1 - 2, 2 - 3, 1 - 3, 4 -5.
2+ hours study and debug, code review, continuously made improvements
C# code comparison: Original is here, and Julia made a new one.
Highlights of change:
1. Change variable names - make it more meaningful.
2. Add one extra variable name in the class GraphNode.
3. Add one sample test case, and use the test case to help understand the code.
Add comment for each function, help user to understand the algorithm.
Status Report
Julia has to work on graph's algorithm in 2017, she understood the algorithm in the contest, but she did not have very strong confidence how to write a very clear, short, concise code in 1-2 hours. There are so many ideas in the submissions, a lot of them are with very short and clear, readable code.
Need to catch up and work hard on the algorithm.
Stackexchange.com code review is here.
Study leaderboard:
1. Eric Sheng
http://ericsheng.com/
printing ascending ascii code.
2. Computer faculty, facebook engineer - click here.
3. PH.D., click here.
4. engineer, coursera achievements, click here.
coursera certificate of algorithm? Look into later.
5. A lot of competition, SQL server program manager before, click here.
6. Look for intern, a lot of competition activities in programming, click here.
7. coursera course, master student, click here.
8. FSU financial math Ph.D., click here.
9. Banking industry experience, J2EE, click here.
10. Alibaba, click here.
11. ASU math phd., ranking around 400, click hackerrank, here.
12. A researcher, click here.
13. over 20 medals, graduate student, Microsoft, click here.
14. CA state programming contest, ranking around 500, HP engineer
15. undergraduate, google intern, ranking around 653,
16. rank 900 - a bachelor student - click here.
Continued Study:
1. More code review by Julia, Julia likes to find out code with good style, 22 C# submission with maximum score, all of players are in ranking top 500, Julia will have a good time learn graph algorithm this time.
Julia learns to write one by one.
Good variable names, click here.
DisjointSet class, click here.
One of code review, click here. (It took hours to rewrite, study first and then try to think about better way to represent.)
Code with unit test cases, study first (ID: yambe2002, ranking: 111/10432), link is here. Code review, link is here.
Julia learned a few things in S.O.L.I.D. principles through code review wiki post, and then she likes to do some code review using some of principles. Code is here.
The value of friendship - problem statement
In the contest
Read the discussion, and prepare to write some code.
Test case: 1 5 3 1 2 3 4 4
What about 1 5 3 1 2 3 4 4 5 Would the answer be 16?
Discussion is here.
Test case - 16
One more discussion is here.
example:
Disjoint set
Review the content on wiki.
Julia spent a few hours to read discussion, and did some research to see how people in top-ranking of content discuss and share their experience. Anything she needs to catch up.
She studied the profile:
Another one shared the advice of using disjoint set, here is the comparison to his contest:
After the contest
Need to practice a few of them.
Study a few submissions in C#, first one is here.
Code review one of C# submission, and work on a test case - a graph with five nodes, 4 connected friendship, 1-2-3 4-5, also 1 is friend of 3. 4 friendships, 1 - 2, 2 - 3, 1 - 3, 4 -5.
2+ hours study and debug, code review, continuously made improvements
C# code comparison: Original is here, and Julia made a new one.
Highlights of change:
1. Change variable names - make it more meaningful.
2. Add one extra variable name in the class GraphNode.
3. Add one sample test case, and use the test case to help understand the code.
Add comment for each function, help user to understand the algorithm.
Status Report
Julia has to work on graph's algorithm in 2017, she understood the algorithm in the contest, but she did not have very strong confidence how to write a very clear, short, concise code in 1-2 hours. There are so many ideas in the submissions, a lot of them are with very short and clear, readable code.
Need to catch up and work hard on the algorithm.
Stackexchange.com code review is here.
Study leaderboard:
1. Eric Sheng
http://ericsheng.com/
printing ascending ascii code.
2. Computer faculty, facebook engineer - click here.
3. PH.D., click here.
4. engineer, coursera achievements, click here.
coursera certificate of algorithm? Look into later.
5. A lot of competition, SQL server program manager before, click here.
6. Look for intern, a lot of competition activities in programming, click here.
7. coursera course, master student, click here.
8. FSU financial math Ph.D., click here.
9. Banking industry experience, J2EE, click here.
10. Alibaba, click here.
11. ASU math phd., ranking around 400, click hackerrank, here.
12. A researcher, click here.
13. over 20 medals, graduate student, Microsoft, click here.
14. CA state programming contest, ranking around 500, HP engineer
15. undergraduate, google intern, ranking around 653,
16. rank 900 - a bachelor student - click here.
Continued Study:
1. More code review by Julia, Julia likes to find out code with good style, 22 C# submission with maximum score, all of players are in ranking top 500, Julia will have a good time learn graph algorithm this time.
Julia learns to write one by one.
Good variable names, click here.
DisjointSet class, click here.
One of code review, click here. (It took hours to rewrite, study first and then try to think about better way to represent.)
Code with unit test cases, study first (ID: yambe2002, ranking: 111/10432), link is here. Code review, link is here.
Julia learned a few things in S.O.L.I.D. principles through code review wiki post, and then she likes to do some code review using some of principles. Code is here.
Hackerrank week code 28 - Choosing White Balls
January 14, 2017
Choose white balls
- problem statement
Introduction
What is the feeling about sitting on the bench while the match is going on? That is something Julia went through in the contest. She tried to do some reach, make 10 - 15 points if possible. One of practice here is to study player's discussion board, and see how top-players are doing when they need to communicate and have some discussion. It is not bad at all to see all over the world, people came together and exchange ideas for the same algorithm.
In the contest
Hard algorithm, maximum score 54
Study the khan summation algorithm - read discussion and found some one
gave out this tip.
The discussion here is very helpful, at least it is
helpful to understand the problem. Work on the example first.
Julia spent 10
minutes to work on the example here:
WBWBW
Analysis with
a fault:
The analysis with
some issues:
step 1: 1, 3, 5
are white and 2, 4 black -> 3/5
step 2: 3 possible
new sequence
BWBW -> 1 WBWB
-> 1 WBBW -> 2/4 -> 1/3 * (1 + 1 + 2/4) = 5/6
total = 3/5 +
5/6 = 1.4333333
Analysis with
corrections:
You do not choose xi, they are chosen randomly. You only choose either left or right for given xi. Therefore in step 1, if xi was 2 or 4, you end up with sequences WWBW or WBWW in step 2, you need to count these in your expectation.
Then you get 3/5 + 1/5 ( 1 + 1 + 2/4 + 1 + 1) = 1.5
Hours of reading - Discussion
BWBWW
BWBBBW
You do not choose xi, they are chosen randomly. You only choose either left or right for given xi. Therefore in step 1, if xi was 2 or 4, you end up with sequences WWBW or WBWW in step 2, you need to count these in your expectation.
Then you get 3/5 + 1/5 ( 1 + 1 + 2/4 + 1 + 1) = 1.5
Hours of reading - Discussion
BWBWW
BWBBBW
Discussion is here.
Summary of Contest Activities
In the contest, spent hours to read the problem statement, discussion, did some research. No code, did not make any points.
January 14, 2017
Choose white balls
- problem statement
Study the khan summation algorithm - read discussion and found some one
gave out this tip.
The discussion here is very helpful, at least it is
helpful to understand the problem. Work on the example first.
Julia spent 10
minutes to work on the example here:
WBWBW
Analysis with
a fault:
The analysis with
some issues:
step 1: 1, 3, 5
are white and 2, 4 black -> 3/5
step 2: 3 possible
new sequence
BWBW -> 1 WBWB
-> 1 WBBW -> 2/4 -> 1/3 * (1 + 1 + 2/4) = 5/6
total = 3/5 +
5/6 = 1.4333333
Analysis with
corrections:
You do not choose xi, they are chosen randomly. You only choose either left or right for given xi. Therefore in step 1, if xi was 2 or 4, you end up with sequences WWBW or WBWW in step 2, you need to count these in your expectation.
Then you get 3/5 + 1/5 ( 1 + 1 + 2/4 + 1 + 1) = 1.5
Hours of reading - Discussion
BWBWW
Hackerrank week code 28 - Suffix Rotation
January 14, 2017
Introduction
Life is not easy to compete the week code on Hackerrank, now Julia's ranking is following behind around 2900 out of 9985 at 11:54am, 1/14/2016. In order to get into the top 25%, she has to continue to work on the problem solving. It will be a lot of fun, a lot of mistakes, and trial and errors.
Have some images to show the progress first, comparison to one in the ranking of 2000:
Comparison to one in the ranking of 1000:
The Great XOR
Julia just found out through the above graph, she had some issues with the algorithm The Great XOR. Spent 5 minutes to look into detail. She did not have any test case failure when she worked on the algorithm, the hackerrank has issues to run so slow, only at the end of day, all test cases will be run. She lost almost 10 points on the algorithm.
Usually, Julia likes to focus on easy and medium level algorithms, now in order to get a bronze medal, she has to learn to work on hard, advanced and expert algorithms, and try to do some research, read the discussion, and come out a simple idea to make extra points.
Lucky Number Eight
Julia did remember the algorithm was scored 18 instead of 10.80, now there are over 5 test case timeout. Six more test cases are added and she failed all of test cases because of timeout.
Comparison to rank 515
Instead, Julia can choose to walk around the outdoor, and get some physical exercise done first.
Study, research, code
Suffix Rotation - problem statement
1. Work on a test case:
string abc, there are 6 variations:
abc-> no rotation, answer is 0
acb-> abc, 1 rotation
bac->acb->abc, 2 rotations, second rotation starting from c
bca->cab->abc, 1 rotation, but circular rotation 2 times
cab->abc, 1 rotation
cba->bac->acb->abc, 2 rotations
2. Work on a test case with multiple instances of char:
string abcbb, what is difference?
abbbc,
if we use counting sort, we can determine the char by counting the number, and then calculate difference.
abbbc
c should be in position of 2, starting from index = 0, but actually it is in position of 4
rotation twice move 4 to 2, and also one of b is in position of 4, it should be in 2, also moved forward.
3. Work on a test case, abcdb,
so c should be in position 4, but it is in 2; 4 - 2 = 2, 1 rotation,
Try to use recursion solution to gain a few points first. And get some ideas about the issues.
Test Case: "cababc"
After more than 3 hours coding, at 10:13pm, Julia studied the discussion related to the test case, Julia found out that there are more than one solution, but need to find minimum move.
string cababc, using her naive solution, it will take 3 moves:
cababc ->
ababcc ->
aabccb ->
aabbcc
but the minimum move only needs 2 moves:
first 'a' is to use the second 'a' in the string "cababc", after first rotation, the string will be "abccab", and the second move is to use second b in the string "abccab", then final string "aabbcc".
How to get the minimum move? Use brute force, then calculate each option for any char from a to z.
Try to find something to think about:
cababc-> ababcc
abccab
From two strings to choose a small one, how to choose?
abccab -> aabbcc
ababcc -> aabccb
Google Search: suffix rotation minimum
ACM ICPC 2003 - the algorithm discussion is here.
One more reading is here.
Review Suffix Array and Longest Common Prefix
Study code review
Introduction
Life is not easy to compete the week code on Hackerrank, now Julia's ranking is following behind around 2900 out of 9985 at 11:54am, 1/14/2016. In order to get into the top 25%, she has to continue to work on the problem solving. It will be a lot of fun, a lot of mistakes, and trial and errors.
Have some images to show the progress first, comparison to one in the ranking of 2000:
Comparison to one in the ranking of 1000:
Julia just found out through the above graph, she had some issues with the algorithm The Great XOR. Spent 5 minutes to look into detail. She did not have any test case failure when she worked on the algorithm, the hackerrank has issues to run so slow, only at the end of day, all test cases will be run. She lost almost 10 points on the algorithm.
Usually, Julia likes to focus on easy and medium level algorithms, now in order to get a bronze medal, she has to learn to work on hard, advanced and expert algorithms, and try to do some research, read the discussion, and come out a simple idea to make extra points.
Lucky Number Eight
Julia did remember the algorithm was scored 18 instead of 10.80, now there are over 5 test case timeout. Six more test cases are added and she failed all of test cases because of timeout.
Comparison to rank 515
Instead, Julia can choose to walk around the outdoor, and get some physical exercise done first.
Study, research, code
Suffix Rotation - problem statement
1. Work on a test case:
string abc, there are 6 variations:
abc-> no rotation, answer is 0
acb-> abc, 1 rotation
bac->acb->abc, 2 rotations, second rotation starting from c
bca->cab->abc, 1 rotation, but circular rotation 2 times
cab->abc, 1 rotation
cba->bac->acb->abc, 2 rotations
2. Work on a test case with multiple instances of char:
string abcbb, what is difference?
abbbc,
if we use counting sort, we can determine the char by counting the number, and then calculate difference.
abbbc
c should be in position of 2, starting from index = 0, but actually it is in position of 4
rotation twice move 4 to 2, and also one of b is in position of 4, it should be in 2, also moved forward.
3. Work on a test case, abcdb,
so c should be in position 4, but it is in 2; 4 - 2 = 2, 1 rotation,
Try to use recursion solution to gain a few points first. And get some ideas about the issues.
Test Case: "cababc"
After more than 3 hours coding, at 10:13pm, Julia studied the discussion related to the test case, Julia found out that there are more than one solution, but need to find minimum move.
string cababc, using her naive solution, it will take 3 moves:
cababc ->
ababcc ->
aabccb ->
aabbcc
but the minimum move only needs 2 moves:
first 'a' is to use the second 'a' in the string "cababc", after first rotation, the string will be "abccab", and the second move is to use second b in the string "abccab", then final string "aabbcc".
How to get the minimum move? Use brute force, then calculate each option for any char from a to z.
Try to find something to think about:
cababc-> ababcc
abccab
From two strings to choose a small one, how to choose?
abccab -> aabbcc
ababcc -> aabccb
Google Search: suffix rotation minimum
ACM ICPC 2003 - the algorithm discussion is here.
One more reading is here.
Review Suffix Array and Longest Common Prefix
Study code review
Ashton and String Hackerrank
my favorite algorithm teacher - JS1
Actionable Items:
Work on the minimum value by simply comparison. Try to get at least 1 point first.
1. check into to document latest progress:
1/15/2017 11:05am
Using my code in C# to test the cases seen in the discussion - link is here.
test case 1: hackerrank - 6
test case 2: suffixrotation - 9
Using queue, and calculate all the possible selections.
But my C# submission still scores 0, pass test case 0, and time out 1 and 2, and runtime error test case 3 on 1.97s.
Rotation definition - misunderstanding
2. Need to look into the rotation definition, see if it is making sense or not.
Choose index bigger than prior move.
but, at the index, perform circular rotation in either direction.
So, work on the example, abcdefjghi, at index 6, with char j, can rotate clock wise or anti-clockwise.
jghi -> anti-clockwise -> ijgh -> hijg ->..
jghi -> clockwise -> ghij -> hijg ->..
So, work on the example: cababc
first work on index 0, work on second a,
clockwise, abccab
anti-clockwise, abaccb
work on first a,
clockwise, ababca
anti-clockwise, accbab
and then, work on second char - index = 1, there are 4 choices.
Because Julia's C# code has wrong answer, probably it is because of her rotation misunderstanding, missing two cases.
Good workout and great learning
Suffix Rotation C# practice - score 0, but perfect learning experience. Julia learns the importance to challenge herself to work on hard algorithm, come out the solution to work ok with sample test cases. She spent more than 5 hours to work on the problem on Saturday January 14, 2016 and two more hours on January 15, 2016.
Have a very excellent experience to work on string manipulation, queue, and also read all discussions to get basic test cases with expected results.
Make some points on hard algorithm in future week code contest. It seems that week of code is most popular contest on HackerRank, and the difficulty level is up-to-most-top-standard.
After contest
code study - link is here.
Code review - rewrite the C# code, study and debug, code is here.
More study on the code, and 2nd version before code review, code is here.
3rd version, code is here.
Status report
Julia finds out that there are so many solutions to study, and she does not have a lot of time to catch up so many things. Just go one by one.
She will work hard on the algorithm, through the contest, she understood that it is most important to stay humble, and she is thankfulness to enjoy the practice. Just learn one thing a time.
Actionable Items:
Work on the minimum value by simply comparison. Try to get at least 1 point first.
1. check into to document latest progress:
1/15/2017 11:05am
Using my code in C# to test the cases seen in the discussion - link is here.
test case 1: hackerrank - 6
test case 2: suffixrotation - 9
Using queue, and calculate all the possible selections.
But my C# submission still scores 0, pass test case 0, and time out 1 and 2, and runtime error test case 3 on 1.97s.
Rotation definition - misunderstanding
2. Need to look into the rotation definition, see if it is making sense or not.
Choose index bigger than prior move.
but, at the index, perform circular rotation in either direction.
So, work on the example, abcdefjghi, at index 6, with char j, can rotate clock wise or anti-clockwise.
jghi -> anti-clockwise -> ijgh -> hijg ->..
jghi -> clockwise -> ghij -> hijg ->..
So, work on the example: cababc
first work on index 0, work on second a,
clockwise, abccab
anti-clockwise, abaccb
work on first a,
clockwise, ababca
anti-clockwise, accbab
and then, work on second char - index = 1, there are 4 choices.
Because Julia's C# code has wrong answer, probably it is because of her rotation misunderstanding, missing two cases.
Good workout and great learning
Suffix Rotation C# practice - score 0, but perfect learning experience. Julia learns the importance to challenge herself to work on hard algorithm, come out the solution to work ok with sample test cases. She spent more than 5 hours to work on the problem on Saturday January 14, 2016 and two more hours on January 15, 2016.
Have a very excellent experience to work on string manipulation, queue, and also read all discussions to get basic test cases with expected results.
Make some points on hard algorithm in future week code contest. It seems that week of code is most popular contest on HackerRank, and the difficulty level is up-to-most-top-standard.
After contest
code study - link is here.
Code review - rewrite the C# code, study and debug, code is here.
More study on the code, and 2nd version before code review, code is here.
3rd version, code is here.
Status report
Julia finds out that there are so many solutions to study, and she does not have a lot of time to catch up so many things. Just go one by one.
She will work hard on the algorithm, through the contest, she understood that it is most important to stay humble, and she is thankfulness to enjoy the practice. Just learn one thing a time.
Friday, January 13, 2017
Practice confidence and match confidence - a sports psychology study
January 13, 2017
Introduction
Julia did some research by reading the article written by Dr. Patrick Cohn about tennis match performance and training, the article "Tennis Psychology: Practice Confidence vs. Match Confidence", she learned a few things. Here are her favorite quotes:
----- great thoughts about tennis sports - coding should also be the same ---------
Let’s start by answering a basic question: What does it mean to play with trust? When you play with trust, you allow yourself to play freely – you have faith in your practice. You don’t grind on your technique or over coach yourself in matches because you are confident that you can rely on your practice. You just react to the ball, knowing your training will carry you.
Through practice and repetition – a lot of it – your body learns how to hit shots effortlessly, instinctively. Meaning with enough repetition and practice, you can hit shots without thinking about how to hit shots. You should think of competition as a “closed book test” to use a schoolwork analogy. You’ve studied (practiced) for the test. In competition, it’s time to trust what you studied.
How does your trust break down all of a sudden when you play in a match? Many mental game or tennis issues can affect your level of trust in matches. A lack of confidence and cause your trust to not show up. Indecision is another barrier to trust. Fear of failure can kill the soundest strokes. Perfectionism can cause you to focus too much on perfect strokes and not enough on strategy and playing smart shots.
What can players do to improve their trust in matches?
Trust starts with having a balance in your practice routines. Practicing the right way will help you improve your trust in matches. The key is to practice like you compete.
----- end of article excerpts ---
Go over again and again - four times!
Julia has faith in her practice!
Julia has faith in her practice!!
Julia has faith in her practice!!!
Practice is getting better.
Introduction
Julia did some research by reading the article written by Dr. Patrick Cohn about tennis match performance and training, the article "Tennis Psychology: Practice Confidence vs. Match Confidence", she learned a few things. Here are her favorite quotes:
----- great thoughts about tennis sports - coding should also be the same ---------
Let’s start by answering a basic question: What does it mean to play with trust? When you play with trust, you allow yourself to play freely – you have faith in your practice. You don’t grind on your technique or over coach yourself in matches because you are confident that you can rely on your practice. You just react to the ball, knowing your training will carry you.
Through practice and repetition – a lot of it – your body learns how to hit shots effortlessly, instinctively. Meaning with enough repetition and practice, you can hit shots without thinking about how to hit shots. You should think of competition as a “closed book test” to use a schoolwork analogy. You’ve studied (practiced) for the test. In competition, it’s time to trust what you studied.
How does your trust break down all of a sudden when you play in a match? Many mental game or tennis issues can affect your level of trust in matches. A lack of confidence and cause your trust to not show up. Indecision is another barrier to trust. Fear of failure can kill the soundest strokes. Perfectionism can cause you to focus too much on perfect strokes and not enough on strategy and playing smart shots.
What can players do to improve their trust in matches?
Trust starts with having a balance in your practice routines. Practicing the right way will help you improve your trust in matches. The key is to practice like you compete.
----- end of article excerpts ---
Go over again and again - four times!
Julia has faith in her practice!
Julia has faith in her practice!!
Julia has faith in her practice!!!
Practice is getting better.
Workout
Julia experienced the anxiety to take a 75 minutes test, therefore, she has to work on more about match confidence and practice confidence.
Code Review: SOLID principles
January 13, 2016
Introduction
Julia found out that code review is a really very good to teach and learn. SOLID principle is such a nice topic for her to catch up - a new begining of 2017.
Study
Write down some notes, and prepare to do more research on this study.
community wiki, very nice lecture about SOLID - click here.
Please put together C# code in the above code review and post here as well.
January 19, 2017 9:00pm - 10:28pm
- spent 90 minutes to go over the encapsulation lecture.
Introduction
Julia found out that code review is a really very good to teach and learn. SOLID principle is such a nice topic for her to catch up - a new begining of 2017.
Study
Write down some notes, and prepare to do more research on this study.
community wiki, very nice lecture about SOLID - click here.
Please put together C# code in the above code review and post here as well.
January 19, 2017 9:00pm - 10:28pm
- spent 90 minutes to go over the encapsulation lecture.
Leadership & Management, Productivity study
January 13, 2017
Introduction
Julia spent a few hours to follow hundreds of managers and technical leaders on linkedin a few months ago since she knows the feature "Follow", what she likes to do is to customize her linkedin feeds and then she can get connected to others better. Make herself more valuable.
After a few months, she came cross this article - Leadership study article. So, she likes to do some study on leadership, and figure out something new in 2017.
Workout plan
Will come back soon.
Introduction
Julia spent a few hours to follow hundreds of managers and technical leaders on linkedin a few months ago since she knows the feature "Follow", what she likes to do is to customize her linkedin feeds and then she can get connected to others better. Make herself more valuable.
After a few months, she came cross this article - Leadership study article. So, she likes to do some study on leadership, and figure out something new in 2017.
Workout plan
Will come back soon.
Thursday, January 12, 2017
HackerRank - week of code 28
January 12, 2016
Introduction
Julia did some research by reading the article written by Dr. Patrick Cohn about tennis match performance and training, the article "Tennis Psychology: Practice Confidence vs. Match Confidence", she learned a few things. Here are her favorite quotes:
----- great thoughts about tennis sports - coding should also be the same ---------
Let’s start by answering a basic question: What does it mean to play with trust? When you play with trust, you allow yourself to play freely – you have faith in your practice. You don’t grind on your technique or over coach yourself in matches because you are confident that you can rely on your practice. You just react to the ball, knowing your training will carry you.
Through practice and repetition – a lot of it – your body learns how to hit shots effortlessly, instinctively. Meaning with enough repetition and practice, you can hit shots without thinking about how to hit shots. You should think of competition as a “closed book test” to use a schoolwork analogy. You’ve studied (practiced) for the test. In competition, it’s time to trust what you studied.
How does your trust break down all of a sudden when you play in a match? Many mental game or tennis issues can affect your level of trust in matches. A lack of confidence and cause your trust to not show up. Indecision is another barrier to trust. Fear of failure can kill the soundest strokes. Perfectionism can cause you to focus too much on perfect strokes and not enough on strategy and playing smart shots.
What can players do to improve their trust in matches?
Trust starts with having a balance in your practice routines. Practicing the right way will help you improve your trust in matches. The key is to practice like you compete.
----- end of article excerpts ---
Go over again and again - four times!
Julia has faith in her practice!
Julia has faith in her practice!!
Julia has faith in her practice!!!
Practice is getting better.
So, Julia learns a few things here:
notes will be written here later.
She understands that it is very important for her to put herself on stress training daily, therefore, she did work on the week of code 28 so patiently, specially on the algorithm "Lucky Number Eight". She still likes to write a recursion function and review her favorite study blog written in less than 2 months - Nov. 24, 2016.
Contest workout
So far, she ranked 1480 out of 9215 on January 12, 2017, 11:23pm
One of Google employee cui aoxiang - performance unbelievable. She just kept finding new faces from Google, facebook, and also extraordinary performance. Next time, study her code and post some thoughts here.
Another good player from google. Click here.
Introduction
Julia did some research by reading the article written by Dr. Patrick Cohn about tennis match performance and training, the article "Tennis Psychology: Practice Confidence vs. Match Confidence", she learned a few things. Here are her favorite quotes:
----- great thoughts about tennis sports - coding should also be the same ---------
Let’s start by answering a basic question: What does it mean to play with trust? When you play with trust, you allow yourself to play freely – you have faith in your practice. You don’t grind on your technique or over coach yourself in matches because you are confident that you can rely on your practice. You just react to the ball, knowing your training will carry you.
Through practice and repetition – a lot of it – your body learns how to hit shots effortlessly, instinctively. Meaning with enough repetition and practice, you can hit shots without thinking about how to hit shots. You should think of competition as a “closed book test” to use a schoolwork analogy. You’ve studied (practiced) for the test. In competition, it’s time to trust what you studied.
How does your trust break down all of a sudden when you play in a match? Many mental game or tennis issues can affect your level of trust in matches. A lack of confidence and cause your trust to not show up. Indecision is another barrier to trust. Fear of failure can kill the soundest strokes. Perfectionism can cause you to focus too much on perfect strokes and not enough on strategy and playing smart shots.
What can players do to improve their trust in matches?
Trust starts with having a balance in your practice routines. Practicing the right way will help you improve your trust in matches. The key is to practice like you compete.
----- end of article excerpts ---
Go over again and again - four times!
Julia has faith in her practice!
Julia has faith in her practice!!
Julia has faith in her practice!!!
Practice is getting better.
So, Julia learns a few things here:
notes will be written here later.
She understands that it is very important for her to put herself on stress training daily, therefore, she did work on the week of code 28 so patiently, specially on the algorithm "Lucky Number Eight". She still likes to write a recursion function and review her favorite study blog written in less than 2 months - Nov. 24, 2016.
Contest workout
So far, she ranked 1480 out of 9215 on January 12, 2017, 11:23pm
One of Google employee cui aoxiang - performance unbelievable. She just kept finding new faces from Google, facebook, and also extraordinary performance. Next time, study her code and post some thoughts here.
Another good player from google. Click here.
Subscribe to:
Posts (Atom)




