Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

There are N egg baskets and the number of eggs in each
basket is a known quantity. Two players take turns to remove
these eggs from the baskets. On each turn, a player must
remove at least one egg, and may remove any number of eggs
provided they all belong to the same basket. The player
picking the last egg(s) wins the game. If you are allowed to
decide who is going to start first, what mathematical
function would you use to decide so that you end up on the
winning side?

Answers were Sorted based on User's Feedback

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

 Is This Answer Correct ? 4 Yes 2 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

There are N buckets & each contains n eggs in it.
Then let opponent to start a game.
If opponent picks x eggs then u choose n-x from perticular
bucket.

This way u can win...

 Is This Answer Correct ? 2 Yes 2 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

It is said that there are N egg bags with eggs in it. So
every bag should have eggs..
Now answer depends on Number of Bags containing only one bag

Suppose there is
1. all bag contains more then 1 egg then I will choose first
2. only one bag with one egg then I will choose second
3. Two bags contain one egg I will choose third..

So It depends on how I reach to the last bag in first place

 Is This Answer Correct ? 1 Yes 2 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

if the XOR of all the numbers of eggs is zero than second
player win else first player will win.
(From NIM game(game theory))

 Is This Answer Correct ? 1 Yes 2 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

n-1 if n is odd and n+1 if n is even

 Is This Answer Correct ? 0 Yes 2 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

n-1 if n is odd and n+1 if n is even

 Is This Answer Correct ? 0 Yes 2 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

0

 Is This Answer Correct ? 1 Yes 4 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

N%2

if it gives 0 then the person can choose to go second.if
nonzero then he should go first.But this logic is acceptable
only if there is atleast one egg in each basket.

 Is This Answer Correct ? 2 Yes 7 No

More C Interview Questions

Explain the concept and use of type void.

pgm in c to reverse string by word using array(god is love becomes love is god) (no additional array can used,space is only delimiter between words )

how to find the size of the data type like int,float without using the sizeof operator?

A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

What is a newline escape sequence?

main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

Explain what are header files and explain what are its uses in c programming?

A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

All technical questions

What are comments and how do you insert it in a C program?

What is the difference between int main and void main?

Categories