You are given an array A of n-elements. There are two players Alice and Bob. A Player can choose any of element from an array and remove it. If the bitwise XOR of all remaining elements equals 0 after removal of the selected element, then that player loses.
Note: Each player play game alternately. Find out a winner if both of the players play optimally. Alice starts the game first. In case one-element in array consider its value as the XOR of an array.
The first line contains an integer T, number of test cases. For each test case, the first line contains an integer n, denoting the size of the array A. Next line contains n-space separated integers denoting the elements of the array A.
For each test case, the output is 1 if Alice wins or 2 if Bob wins.
3 3 2
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.