Wednesday, December 28, 2016

HackerRank - week code 27 - Bronze medal III

Dec. 28, 2016

Introduction
As a hackerrank player, Julia has over 8 months experience. She just likes to be a weekend hackerank player. But she could not find anything in late December, she was busy with holiday parties and missed one contest in December.

But at the end of December, she studied the code written by over 20,000 players, and found one of players played a lot of week code contests.

So, Julia played the week code 27, and she had good time to play and learn something new.

Workout

Facts:
Worked on 5 algorithms -
first one, tailor shop, hackonacci matrix rotation, zero-move nim, last one: how many substrings

Her most favorite algorithm, it is an easy algorithm. But it is fun and a lot of challenging for her. Time complexity is the biggest concern.

Tailor shop


And then, she worked hard on the algorithm, she just enjoyed and then was happy that recursive function does some work for her; and took 1 or 2 hours to study game - Nim, and had a good time to study some game, mathematics.

Hackonacci matrix rotation

score 4 - maximum score 40

Preprocessing, and time complexity is the biggest issue


Zero-Move Nim

Her practice on recursive solution (2+ hours), score 5 - maximum score 50
A lot of fun to practice - learn recursive function
https://gist.github.com/jianminchen/6c0dea2e0f6d500543db06ff640005a9

Using nim sum:

https://gist.github.com/jianminchen/cf2544581810f6f0c614ecc4184861ae

Study code submitted by Google employees:

Java code:

C++ 14 code

C++ 14




How many substrings




Tip to share:
Read discussion on HackerRank, and find out top players - what they are discussing, tips they share in the contest or after the contest.




No comments:

Post a Comment