Microsoft Interview Question for Software Engineer / Developers


Country: India
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
2
of 2 vote

B always wins. B responds with the opposite play of A, so that after B's first turn there are 4 coins, then after B's second turn there is 1 coin. B's strategy is the same for 10, 13, 16, etc.

A wins the variations on N=8 and N=9 by leaving 7 coins on the table after the first turn.

- showell30@yahoo.com March 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

1.C
2.E
3.A

- Jackson March 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

CEA
Let me explain this.
The key is to understand N%3.
Because everyone wants to get the status that there are 1 coins left, and the other one plays the next move. In this status, "I" can always win.
a)If the other played 1, I can play 2
b)If the other played 2, I can play 1.
And I can esure that everystep could be divided by 3,because i can always play "1+2" no matter you play 1, or you play 2.
So
a) IF N%3 = 0, i will play 2 first->(means n-2%3 = 1), and ensure all of next steps can be divided by 3
b)IF N%3 = 1, i can never win because i'm the first to play and b will ensure the each step could be divided by 3.
c)IF N%3 = 2 , i will play 1 and rest steps are exactly the same as a described.

- Nero.Hu2011 March 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Also, this game can be reduced to a similar game, where the goal is draw the last coin. Basically, you set aside the final coin. So the N=7 don't-get-stuck-with-the-coin game becomes the N=6 grab-the-last-coin game. To play the grab-the-last-coin game, you want to leave your opponent with 3 coins, and then they can't grab all of them, but they have to take one, leaving you with the last winning draw.

The strategy works for other variations of this game. Let's say users can draw 9 coins max, but they're compelled to draw at least 1, and the goal is to make the last grab. If I can leave you with 10 coins in that game, then I win. Likewise, I control you if I can stick you with 20, 30, 40, 50, 60 coins, etc. The first player always win that game, as long as the starting number of coins isn't an exact multiple of 10. (If the game starts with 100 coins, then player A is already under control by B.)

- showell30@yahoo.com March 22, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

what do you exactly mean by "proper play"??

- Anonymous March 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A player needs to make sure that after her move number of remaining coins is 1+3*N

- chatbot March 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The loser sequence would be as bellow by proper play, if A plays first:
ABBABBABBABBA
A would be loser, only if its two predecessors are all Bs. Because whatever A takes 1 or 2, B now becomes the first player for the rest of the coins, and according the definition of the list, it would be its next player as the loser.

- chenlc626 March 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I usually tend to ignore questions from India Microsoft as either they are totally out of scope for interview or too vauge

- Adam March 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

how could the answer to the question "if N<4, Can A Win by Proper Play Always?"
is Yes , for N=1 , there is no way that A can win.

- zinga March 27, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Let us assume Both are intelligent players.
If the coins count is 1+3n ... the B can definitely win the game with proper play..
In this case b has to draw coins based on coin selection of A
if(A selects 1coin)
b has to take 2 coins
else
b has to take 1 coin
Scenario 2 Coins count=1+3n+1 or 1+3n +2
A will win with proper play.
A need to offer round figure of 1+3n back to B to win the game.
if

- Anonymous April 22, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More