Wednesday, November 16, 2016

HackerRank - university codesprint - kindergarten adventures (after the contest)

Nov. 16, 2016

It is time to learn Segment Tree quickly. Julia worked on Segment Tree a few times in 2016, but when she worked on the algorithm in the contest, she did not come out the idea using segment tree to solve the problem. Segment tree is also called binary index tree.

The best learning experience is a failure. She will remember forever how segment tree is applied to a real story - kindergarten adventures.

Problem statement

Previous blogs about segment tree:

1. Oct. 18, 2016
Segment Tree Tutorial

2. Sept. 25, 2016
Range Minimum Query blog

3. March 4, 2016
HackerRank: Bear and Steady Gene (I)

Study C# submissions:

1. C# code # 1
2. C# code #2
3. C# code #3
4. C# code #4
5. C# code #5

Study JavaScript submission

Study Java submission

There are over 60 solution to score 30 (maximum score 30), go over one by one, and learn a few tips from those solutions. Write down what you like most - 3 things in Java code.

1. Very structured code

2. Java code to study

No. 1
No. 2
No. 3

C solution

Julia's ideas to improve the performance:

1. Try to write some code first, or do some research to categorize the problem, narrow down the algorithm problem - segment tree. (Quickly go over competition books, search ideas!)

2. Either improving the research of categorizing the problem to classical problem, or be practical, using brute force solution to get a few points. (Just do it!)

3. Give up the effort on advanced algorithm, only focus on one of medium algorithms. If Julia work on this medium algorithm in the contest, put 10 hours work on it, then she could score full score. (Aim low target first!)

4. Try to get in Bronze medal first. Work on medium algorithm (maximum score 30) instead of advanced algorithm (maximum score 80). (Play safe! From medium to advanced)

5. Try to work on an algorithm in 2 hours range - Do not spend more than 2 hours on a problem. First work on medium algorithm each one 2 hours first. Increase the chance to score more points.





No comments:

Post a Comment