Google Interview Question
1,069 Interview Reviews |
Back to all Google Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Development Engineer In Test at Google:
The Game of Nim worded diffently.
| Tags: | brain teaser, design See more , See less 8 |
See more for this Google Software Development Engineer In Test Interview
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (11)
0 of 1 people found this helpful
Helpful Answer?
Yes |
No
Inappropriate?
3 of 3 people found this helpful
Helpful Answer?
Yes |
No
Inappropriate?
3 of 3 people found this helpful
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.
Helpful Answer?
Yes |
No
Inappropriate?
0 of 1 people found this helpful
Helpful Answer?
Yes |
No
Inappropriate?
1 of 2 people found this helpful
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.
Helpful Answer?
Yes |
No
Inappropriate?
1 of 2 people found this helpful
Helpful Answer?
Yes |
No
Inappropriate?
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
Helpful Answer?
Yes |
No
Inappropriate?
Helpful Answer?
Yes |
No
Inappropriate?
0 of 1 people found this helpful
"Are you talking to me?"
Because it sure sounds like you're high. Then I'd get up and leave.
Helpful Answer?
Yes |
No
Inappropriate?
Helpful Answer?
Yes |
No
Inappropriate?
Members can
answer or comment on this question
–
Join Now (It's Free) or
Sign In
0 of 6 people found this helpful
by Anonymous: