Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Upload a C program to demonstrate the behaviour of the game.

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..

Answer / venu

condition: First person should win
The logic is:
1.if n== odd
First person will remove all eggs from the basket.
next until empty baskets ==1, First person will just do
what ever the second person do. Once last basket comes he
will remove all eggs.
2.if n== even
First person will take out all eggs except one, 2nd
person forced to loose 1 chance as he will remove that egg.
Now next step is just do the (1)

Is This Answer Correct ?    1 Yes 0 No

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

Answer / guest

does each basket have the same number of eggs?

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More C Interview Questions

How do you declare a variable that will hold string values?

0 Answers  


What is extern keyword in c?

0 Answers  


In which area global, external variables are stored?

3 Answers  


What are the different properties of variable number of arguments?

0 Answers  


What is define c?

0 Answers  


How can I remove the leading spaces from a string?

0 Answers  


why division operator not work in case of float constant?

2 Answers  


what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }

3 Answers   Honeywell,


Which is best linux os?

0 Answers  


What is the difference between abs() and fabs() functions?

0 Answers  


How is pointer initialized in c?

0 Answers  


what are you see during placement time in the student.

0 Answers   Goldman Sachs, TCS, Tech Solutions,


Categories