@immanuel ohh, i read the Question wrong. :( i was thinking player1 is starting from least numbered heap and player 2 from highest no heap
On Wed, Jun 15, 2011 at 6:36 PM, immanuel kingston < [email protected]> wrote: > Player 1 will take 1 coin from heap 1 > Player 2 has to take the other coin from heap1. > > Player 1 will take both the coins in heap 2. > > Thanks, > Immanuel > > > > On Wed, Jun 15, 2011 at 6:33 PM, sunny agrawal <[email protected]>wrote: > >> check out this case >> n = 2 >> both heaps having 2 coins >> player 2 will win i think >> >> >> On Wed, Jun 15, 2011 at 6:26 PM, immanuel kingston < >> [email protected]> wrote: >> >>> Yes. I am wrong. As per the example, Player 2 will win if he plays >>> efficiently. >>> >>> Let me put my solution this way, >>> >>> If all the the heaps are of size > 1 the Player 1 can win always. >>> >>> Thanks, >>> Immanuel >>> >>> >>> On Wed, Jun 15, 2011 at 5:36 PM, sunny agrawal >>> <[email protected]>wrote: >>> >>>> consider the case. >>>> n = 2; >>>> heap 1 -> no of coins 1 >>>> heap 2 -> no of coins 2 >>>> >>>> >>>> On Wed, Jun 15, 2011 at 5:34 PM, sunny agrawal <[email protected] >>>> > wrote: >>>> >>>>> i think u r wrong.... >>>>> what if heap size -1 is 0 >>>>> i think one should pick atleast one coin else game will draw >>>>> >>>>> >>>>> On Wed, Jun 15, 2011 at 5:17 PM, immanuel kingston < >>>>> [email protected]> wrote: >>>>> >>>>>> First Player can always win. >>>>>> >>>>>> For each heap >>>>>> Pick heap-size - 1 coins if this is not the n-1th heap >>>>>> Pick all coins from the heap if this the n-1th heap. >>>>>> >>>>>> Please correct me if i am wrong. >>>>>> >>>>>> Thanks, >>>>>> Immanuel >>>>>> >>>>>> On Wed, Jun 15, 2011 at 3:13 PM, Piyush Sinha < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> *There are n heaps of coin(numbered from 0 to n-1) with atleast 1 >>>>>>> coin in each heap. There are 2 players. First player can pick any no. of >>>>>>> coins from the least numbered heap, then the second player can pick any >>>>>>> no. >>>>>>> of coins from the least numbered heap. Unless it is emptied, the player >>>>>>> cant >>>>>>> move on to the next heap. The player who picks the last coin wins. >>>>>>> Design an >>>>>>> algorithm for predicting the winner.* >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Piyush Sinha* >>>>>>> *IIIT, Allahabad* >>>>>>> *+91-8792136657* >>>>>>> *+91-7483122727* >>>>>>> *https://www.facebook.com/profile.php?id=100000655377926 * >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Algorithm Geeks" group. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> To unsubscribe from this group, send email to >>>>>>> [email protected]. >>>>>>> For more options, visit this group at >>>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Algorithm Geeks" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Sunny Aggrawal >>>>> B-Tech IV year,CSI >>>>> Indian Institute Of Technology,Roorkee >>>>> >>>>> >>>> >>>> >>>> -- >>>> Sunny Aggrawal >>>> B-Tech IV year,CSI >>>> Indian Institute Of Technology,Roorkee >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> Sunny Aggrawal >> B-Tech IV year,CSI >> Indian Institute Of Technology,Roorkee >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
