Sunday, November 20, 2016

HackerRank stone division - after the contest (series 2 of 5)

Nov. 20, 2016

Introduction
HackerRank - woman codesprint #2 - stone division

Julia learned one algorithm a time after the contest. Every time she fails to solve an algorithm in the contest, it is her favorite learning time.

Spend 20 minutes to study Editorial Notes about the solution first.

 1. Julia's C# solution followed the study: 
After one hour study of the code converted in C#, Julia found out that she overcooked the solution, got too far to do the work instead of being lazy letting recursive function play the role.

First time again in a few month after she worked on linked list, she found out that she had to learn the tip again to fully take advantage of recursive function, give the confidence to allow recursive function to take care of business.

2. Let us learn the recursive again, let it do the beautiful work. And Julia take a break.

C# solution - copy the code from editorial notes: score 50 - maximum score, pass all test cases
https://gist.github.com/jianminchen/85980e8f52c701027fbf25a8f2293e96

Play with code, remove memorization, score 16/50, fail test case 11 and up
https://gist.github.com/jianminchen/de08d6a479e059b4238bec1d23ab6e12

Continue with a blog about recursion study.


No comments:

Post a Comment