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.