Showing posts sorted by relevance for query nim. Sort by date Show all posts
Showing posts sorted by relevance for query nim. Sort by date Show all posts

Saturday, April 1, 2017

Hackerrank HourRank 19

April 2, 2017

Julia will play hackerrank hourrank 19, and the contest will start from 8:00am PDT to 9:00am PDT. She knows what she should work on in the contest.

Beautiful 
Morning 
Run 

Journey of one hour


Recover the Arrays - 8:00 am - 8:20 am


The hour is very fantastic experience. First 10 minutes to read the first algorithm - Recover the Arrays, and then I asked myself what is missing in the problem statement, Julia missed the statement:

the array's number of elements and then each of elements are followed.

Julia took 10 minutes to figure out this, Julia read the graph with highlighted font "5 2 1" - first char in 3 rows asking herself - what is meaning of the number?

Score 20

What are the Odds?


This is the nim game algorithm. Julia tried to recall the algorithm, she read the problem statement in 10 minutes but could not recall the nim game and current algorithm very well. She has to find how many options, and then she searched her coding blog - Nim, reviewed the algorithm and solution.

Time spent: 8:20 - 8:40 am

The game is modified and she started to read special move before starting a game of Nim.
She tried to think about problem, it should be simple to enumerate all possible selection, and each of them play nim game.

No coding. It is hard to recall the game and it takes time to read through the problem statement.

Maximum Tree Diameter 


Julia decided to give third algorithm some time, from 8:52 am to 9:00 am, she likes to read the problem statement. And she did come out the idea what the problem is.


Actionable Items


Julia checked the third algorithm, how many Google employees played, and then she understood the difference, she has to take life style of those players, if she wants to be a good player.


Beautiful morning run - Julia called this hour a beautiful morning run. She got some companions as well.

Read those minutes, cuiaoxiang even finished 12 minutes before the hour. The first full score was made in the first 31 minutes. Unbelievable!

Julia, you should better invest some time and make the algorithm/ data structure as your powerful weapon. So, it does not matter which job you go to, you will have a good time!

Julia was glad to know that she found her reading challenging through the first algorithm. 10 minutes, she finally understood the algorithm. Based on the experience, in hour rank, Julia will try to work on more to read algorithm problem statement, make sure that she can understand easy algorithm in first reading.

Sports warmup 



Julia's favorite warmup - Sharapova warmup with her coaches 4 minutes video

                                         Angelique Kerber - tennis ball warmup


Tennis Olympics - Andrea Petkovic, Angelique Kerber, Juergen Melzer and many more 4 minutes video.

Sunday, October 1, 2017

University code sprint #3 - Bob's Game

Oct. 1, 2017

Introduction


It is the busy day, a Sunday. I got a flat tire yesterday, I felt lucky to get flat tire when I walked out my home around 6 PM and I saw the flat tire. The worst thing is that I get a flat tire when I am driving on the road, or I walk to the car after one day work. I should work on the tire to get it replaced since more than 3 weeks ago a young man stopped at traffic night inside the car told me that I have a tire almost flat and I need to take care of it.

I joined CAA last night and had to work on fixing the tire.

The contest I played yesterday I did not score anything, I started around 2:00 PM, and then I tried to prepare China trip next Wednesday, and then I went over the documents I had. In the evening I worked on the third medium algorithm but I spent around 2 hours, but I did not make it. It is a medium algorithm with maximum score 50. I did work on a test case: ["...",".K.","..K"], I found out that I need to handle intermediate position of K each step.

Here is the C# code I submitted a few times and only passed test case 1.



Love the failure



I always know that I am not very competitive programmer, I have to work on medium algorithm very carefully. Otherwise, I may spend time but score 0.

I plan to work on those algorithm in university codesprint #3 after the contest one by one. I like to show that I am working hard and also learning things. Plan to ask questions on code review website as well.

Piece of puzzle to learn NIM game


It is like playing chess to figure out NIM game, I put down some drawing to work on the algorithm. I figured out I failed the test case, and then I like to show my drawings. I am the engineer who was trying to figure out NIM game by myself, around 8:00 PM - 10:00 PM Sept. 30, 2017 Saturday night.

Mark the night as a hardworking Vancouver programmer Julia Chen chose to work on, let us call it NIM game night. Here is the drawing to figure out a test case for the game:



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.




Thursday, December 22, 2016

HackerRank - week of code 27

Dec. 12, 2016

Work on HackerRank week of code contest first time. Here is the contest information:

https://www.hackerrank.com/contests/w27/challenges

Continue to work on Day 4 -

Zero-Move Nim

Medium level algorithm, maximum score 50, Julia made it 12.50

So, she likes to do some research and see if she can understand the algorithm, and write a short algorithm. Time: 8:50pm, 3 more hours before the closing time.

Study the lecture notes first:

http://www.math.ucla.edu/~tom/Game_Theory/comb.pdf
http://codeforces.com/blog/entry/20357


Two submissions:
1. One uses recursive solution.


2. One used Nim knowledge.


Wednesday, February 1, 2017

Udacity - algorithm - social network analysis

Feb. 1, 2017

Plan to take the course, 15 minutes a time. Test how good I can to follow the lecture. 

Udacity

intro to algorithms

Social network analysis

Course overview is here. 

Lesson 7: Spy Control Setup - game of Nim 

Julia also worked on Hackerank - game of Nim recently. Here is the blog. 


Feb. 12, 2017

Duncan Watts - Microsoft principal researcher. 

Lili Cheng - The sociable researcher in Microsoft. 

Keynote: Building a Social-Search Engine From Scratch, one hour video. 

Tuesday, October 24, 2017

Hackerrank: Women's CodeSprint 4

Oct. 24, 2017

Introduction


It is the time to play another codesprint this Friday. I thought about yesterday and decided to join until this Thursday, because I need to discipline myself to work on the contest. It is not an easy task because of the busy schedule.

Here is my last two contests on Hackerrank.


I documented the university codesprint 3 contest here. I just could not believe that after the contest, I wrote the blog to celebrate my piece of puzzle to solve NIM game. It is just another contest, and not so good performance. Surprisingly, I got some feedback through a phone call, unbelievable story in the city of Vancouver. 


CodeSprint strategies 


I spent extra 20 minutes to look up bible verse for my contest. Here is bible version Proverb 13:4 for my woman codesprint 4.

Statistics


The blog was written from 6:00 am to 6:20 am, Oct. 24, 2017. I just came back from China and went back to work starting from Oct. 23, 2017. I need to get rid of jet lag, I came back on Oct. 20, and this is the fourth morning with jet lag, I went to bed around 8:00 PM, and woke up around 3:00 AM, and then read wechat to 5:00 am, and got up at 5:30 am.