Sunday, February 21, 2016

New School - HackerRank - algorithm: Beautiful Pairs

February 21, 2016

HackerRank is Julia's new school -  her new lover.  But problem statement is too long to read, and the test cases are not very clear.

Julia starts a new journey with HackerRank, she likes the algorithm problem solving. She spent 2 hours on Sunday morning to work on an easy problem in a "101 Hack Feb 2016".

Here is the question:

Beautiful pairs

Problem Statement 
 

Here is her answer with a bug - failed 2 of 6 test cases:
   

Performance review:

  40 minutes - calm down, read problem statement - she has to understand the problem first.

  Failed 2 cases - that is the value of HackerRank  - good practice.

Lesson learned:
  20 minutes coding,
  20 minutes bug fix: Array size: 1000->1001 to remove run time error,
  the score: from 3.8 to 15.80.
  Wrong answer for 2 test cases.

 Here is the perfect version - fixed the bug.
 

Conclusion:

Each school is different, HackerRank is cool! Julia, just be humble. Make mistakes, always work on easy question, work on the first one in next 5-10 practice. One question a time.

Julia, you have to go through hackerRank contests, go through training - the article detailed on this:

  • You’ll learn how to critically analyze your work. Because you don’t get credit for solving a problem until the code you write can generate the correct results for a large input set (and you don’t know what that input set looks like), you’re forced to think about things such as time complexity, memory usage, and nasty corner cases. Importantly, most of this work happens outside the context of a debugger. Debuggers are invaluable tools for figuring out why a given piece of code is buggy, but it’s better if you can write bug-free code in the first place. In an interview situation, candidates who can’t statically analyze their code generally have trouble showing their solution is correct (or figuring out why it’s not).
https://medium.com/@dpup/whiteboarding-4df873dbba2e#.ps92c99lb
https://code.google.com/codejam/contests.html
https://code.google.com/codejam/contest/6224486/dashboard#s=a&a=0

Be a better programmer to grow in your current job -

http://blog.hackerrank.com/3-ways-crush-technical-interview/
http://dandreamsofcoding.com/2014/03/18/dissecting-an-interview-question/
http://dandreamsofcoding.com/2015/01/09/dissecting-an-interview-question-math-is-hard/
http://dandreamsofcoding.com/2014/08/01/dissecting-an-interview-question-reconstructing-a-tree/

No comments:

Post a Comment