Monday, January 30, 2017

Code Review - Leetcode 210 - Course Schedule II

January 30, 2017

Review Leetcode 210 - course schedule II.

Here is the practice on January 30, 2017.

Last practice is here.

Code review is here.

Actionable items:

Jianmin Chen got her profile setup on codechef.com.

Read a story written by an Amazon developer.

Code review - Hackerank Queen's Attack II

January 30, 2017

Queen's Attack II

Julia learned the hard way, she spent 3 hours in the contest and then worked out a solution. She wrote directions array and define 8 directions. But, she did not push her through to avoid any redundant code, spent time on intermediate results. Near 3 hours, she put together the C# code here in the contest.

She reviewed the statistics, people can finish the algorithm in less than 20 minutes.
The idea is to enumerate each direction by going through the array, and encapsulate all directions’ info inside the array, open for extension but close for change. All direction information update are limited to the two arrays only.

Avoid writing if statement for each direction.

Write again in less than 20 minutes, C# code.

Write again with two changes, C# code.
1. use implicit type local variable var
2. use HashSet<Tuple<int,int>> instead of HashSet<string>

Code review on stackexchange.com is here

Actionable Items:

Always spend extra 30 minutes to one hour, share the practice with the community on code review on stackexchange.com. Therefore, Julia has time to share her thoughts how she learns through her experience first, and then collect feedback. 

Most of important, Julia has to learn to work closely with the community, and be open in 2017. Do not be a  lone worker. It is your job to get involved with multiple communities. Find those communities first. Learn from WTA double ranking top 1 - Bethany.  Julia recently wrote a blog about Safrova's coach Rob Steckly, and watched her video about her coach's coaching style.

Bethany Mattek-Sands - be aggressive, and have fun - Safarova

Usually in tennis sports, double player is more open compared to the single player. Because the double players have to learn how to work with each other. Here is the dance she likes the two double champions most, they learn to work with each other, be aggressive and be happy, no matter the results. 

Julia also learns how good they are sharing how they work together. Here are 4 minutes talk.

Julia likes the marketing skills and styles, top 1 ranking WTA double player in January 2017, Bethany Mattek-Sands, she watched her practice in Beijing in Oct. 2016.



Sunday, January 29, 2017

User experience study

January 29, 2017

Introduction

Julia did some design when she starts to think for customers, in a lighting manufacturer industry, she also learns that people are from different background, do not take for granted that every one knows physics (wattage, voltage, resistance) very well. She keeps improving of her knowledge as a good user experience designer for a small commercial website day by day.

She came cross the facebook user experience manager linkedin profile through a study, and then she decides to have a first study how user experience works in the facebook. Just go over those people's linkedin profiles, and find some articles to read, and discussion topics.

The idea to conduct a study is from the review of her own blog and she found something interesting.

To make thing nice and clean, less is more, do not make it too busy, she learned from the work. Try to go over the website daily, and figure out CSS issues, talked about CSS and continuously study and write code using CSS and html, Julia also learned how to train herself thinking like a good designer.

One of her favorite websites is tennis No. 1, just retired player Ana, Julia studied the website again and again. That is her favorite one.

Study
Will come back to write down what she learns.

Pluralsight.com - SOLID Principles of Object Oriented Design

January 29, 2017

Go over the lecture video - Pluralsight.com - SOLID Principles of Object Oriented Design. Try to put together demo code used in the lecture notes, and post it here.

Actionable Items:

Hack Google interview from MIT, read some course info.

Hackerrank world codesprint 9 - comparison study

January 29, 2017

Introduction

It is a long break Julia took in weekends, and she chose to do some study and practice on Hackerrank. Compared to her first 4 years experience from 2011 to 2015 to attend church small group activities in each weekend, she tried to build up a good habit to do some independent study on Hackerrank, programming competition.

She learned a tremendous team work through the church small group activities, through meeting preparation, lectures, small discussion, group activities. She learned the importance to help new comers to have a good study of bible each time.

Related to hackerrank contests, Julia also learned through the study, and track how other players work with hackerank. People with a lot of competition experience all come to take part in the world codesprint and make the event so helpful. So, she studied players, and then found out where she should go in order to improve her strength in coding and some other research.

She chose to do some study after hackerrank world codesprint 9. Because it was so different, the contest started from Friday instead of Saturday, Julia had to go out to play some tennis sports in Saturday day time, she only ended up with around 6 hours to play the contest. She missed the bronze medal and then she spent time to do study of players.

She decided to take some time to study the player one at a time. The facebook is really a great company and Julia also had chances to attend a few of tech events in Vancouver before. So, she likes to take some time to read the article about news feed through a post on linkedin profile.


Study

Study a hackerrank player - a facebook engineer, first study the performance of contest. At least, Julia still covered some basics in her performance compared to a top engineer and a past top researcher. She understands the basics very well. Julia should spend some time to do some research in last advanced algorithm, the player - Gregory Hornby made 10 points out of maximum score 100.

Spend a few minutes to read a graph, picture tells the number:



Julia enjoyed the reading of linkedin profile. She noticed that a few things are in good writing in the profile.

Study industry, study the scholar website, link is here.

Plan to read about the article - who controls your facebook news feed?

very well-written article - it takes more than 20 minutes to read.
The research of news feed by facebook - It has responded by developing a sort of checks-and-balances system in which every news feed tweak must undergo a battery of tests among different types of audiences, and be judged on a variety of different metrics.

Actionable Items

1. Spend 30 minutes to setup scholar web content for myself - Jianmin Chen, Florida Atlantic University.

No matter how small progress she makes, it all starts from somewhere, humble beginning. All it takes is the time, effort, care, and some determination and a little of love. Research is a fun experience.

Jianmin Chen's scholar.com web page. First time Julia spent less than 10 minutes to setup. The link is here.

2. More facebook articles to read.
Facebook's unethical Experiement

3. A video "Beware online 'filter bubbles"

4. Facebook UX research - Ph.D., the manager.




A comparison study - how to get more advance skills through practice?

January 29, 2017

Once a while, Julia will push herself calm down to go through lecture notes through pluralsight.com. And this Sunday she has to sit down and listen the lecture notes about encapusulation and SOLID on pluralsight.com. It will take 3 - 5 hours for the lecture. Sometimes, she does some workout using her medicine balls and do some stretches and enjoy some cooking time as well. 

Meanwhile, she is also doing some study about a senior google employee - how others take time to practice, on hackerearth and then Julia knows that it takes time and some determination to further improve her practice. 

A small and quick study after hackerrank world codesprint 9  contest. 

Practice on Hackerearth

Comparison to Shanghai Google senior developer - cuiaoxiang

Hackerearth profile is here.

Hackerrank profile is here.

75 problems solved on Hackerearth.

Number tells everything. Julia only practiced 2 algorithms on hackerearth.com. It takes time to practice 75 algorithms. Comparison on world codesprint 9 is here.

Hackerearth activities study is here.

Hackerank world codesprint 9 - comparison study

January 29, 2017

Introduction
In order to improve performance at contest, Julia likes to do some research on performance study. It is well-known to work on one algorithm a time. Make a small change a time, even starting from a habit, to play Hackerrank world codesprint every time, even Julia did not get a bronze medal this time, she learned a few things from other google employees as hackerrank players as well.

She did compare herself to a few of google employees, and how she should start to build some small habit, make some change in her lifestyle, or as a hackerrank player, learn something valuable one a time.

Study

Study 1: 
Julia did some research to compare one google employee, who scored just 0.65 above her, ranking is 1000 in advance, a bronze medal. Here is the comparison:


Some thoughts about practice:

Julia, you have to work on some research and study on those medium above algorithms, try to work on any one of them, even it is the advanced level. Try to make some sense of algorithm, and be able to score a few points. 

Bring yourself out of the comfortable zone, and work on the unfamiliar area - think, read, study, and look for any clue to help yourself. Play like a competition. 

0.65 point makes big difference. A bronze medal is a great encouragement in competitive world. 

Study 2: 

Compared to another google employee with bronze medal, same score: 60. Julia, work on the contest as early as possible. It makes some sense in ranking. 

Study 3: 

Compare to a silver medal player - a google employee. The score comparison is 89.30 to 60:


Julia, check the submission success rate, and then determine which one to work on first. 

Study 4:

Comparison to Shanghai Google senior developer - cuiaoxiang

Hackerearth profile is here.

Hackerrank profile is here.

75 problems solved on Hackerearth.

Number tells everything. Julia only practiced 2 algorithms on hackerearth.com. It takes time to practice 75 algorithms. Comparison on world codesprint 9 is here.

Hackerearth activities study is here.

Study 5:
Top player, facebook hackercup finalist in 2016.

Player profile on Linkedin -  link is here.

Study 6:

Linkedin In profile is here.

Hackerrank profile is here.

Work on 3 algorithms, and each of them score around 10 - a small work makes big difference - experience helps.

Julia compared her performance to the player who worked for Microsoft, Google and now for facebook, comparison is here.

Encouraging thoughts:

Julia stopped her worries after the practice, specially after more than one hour comparison study. She also learned that other best engineers are also working on the same problem set, and also tried to get some points through each of medium above algorithms as well. It is not easy for all of us.

Compared to other players in top companies, Julia did not have enough competition practices, nor does she has a solid practice,  through hackerearth.com log, through past GPA, past research experience.




Hackerrank world codesprint 9

January 29, 2017

Contest Summary 


Julia worked on first 4 algorithms.

Started around 4:30pm on second day of contest, Julia managed to complete the first 3 algorithm, scored 60, rank 2076 out of 6866, at 1am, January 29, 2017. Julia tried to work on 5 algorithms in 2 hours from 11:00pm to 1am, try to score 10 out of possible score - an array of {50, 60, 70, 90, 100}, one medium, one hard, one advanced, 2 expert algorithms, and tried to make any point to push the ranking forward, but she did not have enough time to study, do some research on those algorithms.

Journal of Contest


Grading Students
Time: 5:25pm - 5:33pm

Weighted Uniform Strings
Time: 5:39pm - 6:48pm
C# code is here.

Queen's Attack II
Time: 7:24pm - 10:35pm
She spent over 2 hours to work on Queen's Attack II, and also she learned a few lessons through the practice. A very good workout! She tried a few times, scored 20, 24, and then scored maximum score 30.

First submission, failed a few test cases, score 20.4 (maximum 30), C# code is here.
Second submission, failed a few test cases, score 24.51, C# code is here.
Third submission, passed all test cases, score 30, C# code is here.

Use online text comparison tool, compare the difference between two versions.
Code comparison is here, left side is third version, right side with bugs.
The idea used in the third version is to avoid redundant checking directions, therefore only one copy for each check, less time to do testing to remove bugs.

Kingdom Division
Time: 11:00pm - 1:00am
She spent more than 2 hours to play with the algorithm starting from 11:00 pm in January 28, 2017. She did have some simple idea to work on. For example, find all cities with only one connected city, and then form a group with those two cities.

Actionable Items


Need to think about how to improve the performance on the first medium algorithm - queen'a attack II, work on writing readable code, follow DRY principle, therefore, time can be cut in less than one hour for the algorithm. Close to 3 hours, including a 20 minutes dinner.

Study some players and get confidence back to work on medium above algorithms. 


Follow up after contest


January 30, 2017

Queen's Attack II

Julia learned the hard way, she did write directions array and define 8 directions. But, she did not push her through to avoid any redundant code, spent time on intermediate results. Near 3 hours, she put together the C# code here in the contest.

She reviewed the statistics, people can finish the algorithm in less than 20 minutes.

The idea is to enumerate each direction by going through the array, and encapsulate all directions’ info inside the array, open for extension but close for change. All direction information update are limited to the two arrays only.

Avoid writing if statement for each direction.

Write again in less than 20 minutes, C# code.

Write again with two changes, C# code.
1. use implicit type local variable var
2. use HashSet<Tuple<int,int>> instead of HashSet<string>


Thursday, January 26, 2017

Code review by user: Simon Forsberg

January 26, 2017



Simon Forsberg

1. Study 23 program challenges, link is here.

2. Study 53 algorithms, link is here.

3. Study 23 interview questions, link is here.

Code Review: by user Bazhang

January 26, 2017


Work on 20 algorithms review by Bazhange, here is the link.


Wednesday, January 25, 2017

A small study of code review on stackexchange.com

January 25, 2017

Introduction
Julia likes to review what she did on code review - stackexchange.com up to January 25, 2017.

Show her profile with some statistics.

Julia likes to memorize her profile with 7%. (Julia counted the top ranking: 42 of the month) Just display the image here to document her journey, inspire others to involve with tech community as well.

14 algorithms 

Julia asked 14 questions, and she likes to write something for each algorithm to entertain herself - Good work, hard work, and continue!

Write down 3 mistakes, 3 good stories to share, and 3 things to work on improvements.

Will be back to write here... stay tuned!


Case studies

Julia had top 7% performance this month. So, she did some research top users, and then, she found two users - she likes to find out something interesting. Let us take a look at picture first.


fer-rum 4 answers are here

Read moderator - Simon Forsberg's twitters.

You are being watched! - Comments of Interest


Simon Forsberg

1. Study 23 program challenges, link is here.

2. Study 53 algorithms, link is here.

3. Study 23 interview questions, link is here.

A guide to Code Review for Stack Overflow users



Udacity free course - technical interview by pramp

January 25, 2017

Introduction
Julia went to a meetup in the city of Vancouver in Dec. 3 2016, she met a UBC undergraduate student. And also she was told that the interview course on Udacity is very good. So, Julia likes to take the course and learn something at the beginning of 2017.

Course Study

Technical interviewing:
1. Interview introduction
2. Clarifying the Question
3. Confirming inputs
4. Test cases
5. Brainstorming 
6. Runtime Analysis
7. Coding 
8. Debugging
9. Interview Wrap-up 
10. Time for Live practice
11. Next Steps

7 Steps: 
- Clarifying the Question
- Generating Inputs & Outputs
- Generating Test Cases
- Brainstorming 
- Runtime Analysis
- Coding
- Debugging 

1. Interviewer is there to help you. He/ she is on your side.  Being able to take feedback showing your team work skills. 

Positive mindset, do not give up!




Monday, January 23, 2017

Code review - A coffee maker

January 23, 2017

Julia likes to choose something to study, she plans to spend 30 minutes on the coffee maker code example - pluralsight.com course encapsulation and SOLID.

And also she likes to review the questions on stackexchange.com:

Designing a coffee machine



Study C# questions answer by Ebrown, link is here.

  1.    C# Rental Program
Actionable Items:

1. Plan to take free course on Udacity.com - technical interview by pramp.com

2. Study the example using decorator on wiki, and then post C# code here. Learn one pattern a time. (Feb. 8, 2017)

Sunday, January 22, 2017

Code Review: Leetcode 56: Merge Intervals (II)

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.


Code review - convert tree to list

January 22, 2017

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.



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.

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.

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.


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.
working code is here.

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

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 hackerrankhere.
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

Set up a test case for BWBWW - the answer should be
Discussion is here.

BWBBBW

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

Set up a test case for BWBWW - the answer should be
Discussion is here.


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.