Grundy Number
Two players Alice and Bob are playing a game. They have a pile with n coins in it.Input Format
They can pick only allowed numbers of coins at a time given in an array picks.
Alice goes first and they take alternate turns.
The player who picks the last coin is the winner. Can you find out the winner.
The first line contains integer n(no. of coins in the pile).Output Format
Second line contains size of picks array say l
picks[0]
picks[1]
....
picks[l-1]
Print the winner (ALICE or BOB).Question Video
1<= n <= 1000Sample Input
8Sample Output
3
5
1
4
BOB
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run