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 arrayInput Format
The first line contains integer n, no. of integers.Output Format
second line contains n integers arr[1],arr[2]...arr[n].
Print the winner (Alice or Bob).Question Video
1<= n <= 10^5Sample Input
1<= arr[i] <= 10^8
5Sample Output
15 6 9 10 20
Bob
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run