Redirecting to
NADOS

Winner In Nim Game

Given an array of integers, two players Alice and Bob are playing a game where Alice can remove any element from the array.If the bitwise XOR of all remaining elements equals 0 after removal of selected element, then that player looses.Find out winner if both of the players play optimally. Alice starts the game first. In case case one-element in array consider its value as the XOR of array
Input Format
The first line contains integer n, no. of integers.
second line contains n integers arr[1],arr[2]...arr[n].
Output Format
Print the winner (Alice or Bob).
Question Video
Constraints
1<= n <= 10^5
1<= arr[i] <= 10^8
Sample Input
5
15 6 9 10 20
Sample Output
Bob


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name