Redirecting to
NADOS

Two Pile With Grundy Number

.

Two players Alice and Bob are playing a game. They have 2 pile's with n1 and n2 coins in it.
They can pick only allowed numbers of coins from any one pile 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.
Input Format
The first line contains two integers n1 and n2.
Second line contains size of picks array say l
picks[0]
picks[1]
....
picks[l-1]
Output Format
Print the winner (ALICE or BOB).
Question Video
Constraints
1 <= n1, n2 <= 50
Sample Input
4 3
3
1
4
2
Sample Output
ALICE


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name