Redirecting to

Nim Game

Two players Alice and Bob are playing a game. They have n piles. ith pile conatins arr[i] no. of coins. In each move a player can choose a pile and remove as many coins as he wants (minimum 1 coin). The player who removes the last set of coins from table will win. Alice goes first.
Input Format
The first line contains integer n, no. of piles.
second line contains n integer containing number of coins in each pile.
Output Format
Print the winner (ALICE or BOB).
Question Video
1<= n <= 10^5
1<= arr[i] <= 10^8
Sample Input
1 2 3
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name