Google Interview Question: The Game of Nim worded diffen... | Glassdoor

Interview Question

Software Development Engineer In Test Interview Kirkland, WA

The Game of Nim worded diffently.

brain teaser, design

Interview Answer

11 Answers


The Name of the Game.

Anonymous on Oct 12, 2009

The anwer is 'Take' from the german word nimm.

Ryan on Oct 18, 2009

There is a game called 'The Game of Nim' that has a specific mathematical equation that must be utilized in order to win the game. Nimm is the German word for Take, so you must figure out the best way to take the matches without your opponent beating you at it.

SelenityHyperion on Oct 19, 2009

The Game of Nim is a simple board game in which you and your opponent take turns removing a number of matches from one of the rows (normally about 5 rows) of matches on the board. The person to take the last match off the board is the winner.

The reason why it is of interest to us as prospective software engineers (and why you probably asked this question) is that it has some interesting binary number properties making it fairly trivial to write computer code to ensure a win every time (every time there is a starting advantage, that is).

Would you like me to go into more detail?

Ok, well in brief then, basically the trick is to take the number of matches in each row and represent this as a binary number. Then, either by hand or with a program, do an Exclusive Or operation on the numbers. Then whenever you take some matches, just ensure that the remaining total is always zero after your turn and you will be sure to win by the end of the game.

Maybe I should also add (and I'm thinking out the box here), that sometimes we as people are up against a challenge or opponent where succeeding or beating them is seemingly reliant on chance or luck. However, with careful analysis of the problem and good strategising, it turns out it is actually possible to ensure success just about every time. On the other hand, there are times when the odds are against us from the start. Then either we must stand up for what we believe is fair (i.e. be aware and vocalise that we cannot possibly win), or else acknowledge that our opponent is worthy and will ultimately get the better of us. Yet it should be noted that we can still stay strong and be competitive from the beginning allowing us to possibly take advantage of any mistakes or weaknesses our opponents or challenges might display.

That is the Game of Nim worded differently.

Andrew_Bryce on Oct 23, 2009

What does this question have to do with Quality?

Astrochimp on Oct 25, 2009

Nim's Game

If I was interviewing you and asked you that question, I would be trying to determine if you could take a simple problem and provide a simple solution. If you went off into the weeds like Andrew_Bryce did, I would be wondering how effective you would be solving tons of simple issues. Also, if you answered the wrong question (what is the Game of Nim?) and not the question I asked (how would you word differently the phrase The Game of Nim?), I would be wondering how good your communication skills were.

OneEye on Oct 28, 2009

If I were being interviewed, I would wonder about the interviewer's communication skills. "The game of Nim worded differently" isn't a question. It isn't even a sentence.

Count Negroni on Oct 29, 2009

"Foaming Theme"

1) I cheated
2) I didn't even know what Nim was before I looked it up

Here's how I would interpret some answers and the job I would recommend for them

Anonymous: Huh? I think you're trying to be a smartass, but I don't get it - Cafeteria Worker

Ryan: Knowledgeable - Content provider

SelenityHyperion: Knowledgeable, informative and relatively succinct - Writer

Andrew_Bryce: Detail oriented and a perfectionist - Software tester, some forms of coder

Astrochimp: Focused - Project Manager

OneEye: Thinks his answer is the only correct one - Clearly VP material

Count Negroni: Nit Picker - Editor

I don't think there's supposed to be one correct answer

The Nim Master on Oct 29, 2009

Ha ha, jokes on me. "The Game of Nim worded differently." is not the actual question, just a vague description.

The Nim Master on Oct 29, 2009

I would answer:

"Are you talking to me?"

Because it sure sounds like you're high. Then I'd get up and leave.

io6060 on Oct 30, 2009

Strategic domination

LOTSAFRECKLES on Jan 7, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.