Tag Archives: codejam

Coin Jam - What I Did (Google CodeJam 2016)

In my quest to learn more about this competition that I just recently discovered, I came across this page where the Google Code Jam problem authors discuss their process for creating well-designed competition problems.  The whole thing was an enlightening read, but I mention it here to reference the section where they discuss problem difficulty, which ends with this:

This is (very roughly) what we aim for in Code Jam's qualification round: easy; easy, but insight required; medium-hard.

When I read this it made perfect sense to me in the context of the Qualification Round problems I've been documenting here.  The first problem was easy.  The second problem was easy, once you had the right insight about how to optimally flip the pancakes.  With that said, we now move onto the third problem where the difficulty definitely ramps up.

Continue reading

Revenge of the Pancakes! (Google CodeJam 2016)

In the second problem of the Qualification Round we find ourselves in a strange IHOP:

The Infinite House of Pancakes has just introduced a new kind of pancake! It has a happy face made of chocolate chips on one side (the "happy side"), and nothing on the other side (the "blank side").

You are the head waiter on duty, and the kitchen has just given you a stack of pancakes to serve to a customer. Like any good pancake server, you have X-ray pancake vision, and you can see whether each pancake in the stack has the happy side up or the blank side up. You think the customer will be happiest if every pancake is happy side up when you serve them.

You know the following maneuver: carefully lift up some number of pancakes (possibly all of them) from the top of the stack, flip that entire group over, and then put the group back down on top of any pancakes that you did not lift up.

What is the smallest number of times you will need to execute the maneuver to get all the pancakes happy side up, if you make optimal choices?

Continue reading

Counting Sheep (Google CodeJam 2016)

The first (and presumably easiest) of the four problems in the Qualification Round is a pretty straightforward counting problem:

Bleatrix Trotter the sheep has devised a strategy that helps her fall asleep faster. First, she picks a number N. Then she starts naming N, 2 × N, 3 × N, and so on. Whenever she names a number, she thinks about all of the digits in that number. She keeps track of which digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) she has seen at least once so far as part of any number she has named. Once she has seen each of the ten digits at least once, she will fall asleep.

What is the last number that she will name before falling asleep?

Continue reading

My CodeJam Experiment

A few weeks back I saw a mention of Google Code Jam 2016.  I'm relatively new to programming but I love a good challenge.  So I registered, figuring it would be a good test of what I've learned so far.  However, I pretty quickly forgot about it, and would've totally missed it if not for an email reminder yesterday.  I felt totally unprepared but decided to give it a shot, and here's what happened...

Continue reading