


N = 3
A = [ 3, 4, 5 ]
Explanation :
One of the optimal ways to play the game is :
Ninja removes 3 stones from the first pile : [ 0, 4, 5 ].
Friend removes 3 stones from the second pile : [ 0, 1, 5 ].
Ninja removes 3 stones from the third pile : [ 0, 1, 1 ].
Friend removes 1 stone from the second pile : [ 0, 0, 1 ].
Ninja removes 1 stones from the third pile : [ 0, 0, 0 ].
Thus Ninja wins the game here.
The first line contains an integer 'T' which denotes the number of test cases to be run. Then the test cases follow.
The first line of each test case contains an integer ‘N’ denoting the number of piles of stones.
The next line contains ‘N’ integers representing the elements of array ‘A’. ‘A[i]’ denotes the number of stones in pile number ‘i’.
For each test case, output 1 if Ninja wins the game and 0 if he loses.
Print the output of each test case in a new line.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 10^5
1 <= A[i] <= 10^9
Time Limit : 1 sec
Algorithm :
Tic Tac Toe Winner
Tic Tac Toe Winner
Tic Tac Toe Winner
Tic Tac Toe Winner
Tic Tac Toe Winner
Tic Tac Toe Winner
Minimum Knight Moves
Minimum Knight Moves
Minimum Knight Moves
Minimum Knight Moves
Coins and Rows
Axel and Shawn’s Football game
Alice And The Game Of Coins