We are given non-negative integers nums[i] which are written on a chalkboard.  Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first.  If erasing a number causes the bitwise XOR of all the elements of the chalkboard to become 0, then that player loses.  (Also, we'll say the bitwise XOR of one element is that element itself, and the bitwise XOR of no elements is 0.)
Also, if any player starts their turn with the bitwise XOR of all the elements of the chalkboard equal to 0, then that player wins.
Return True if and only if Alice wins the game, assuming both players play optimally.
Example:
Input: nums = [1, 1, 2]
Output: false
Explanation: 
Alice has two choices: erase 1 or erase 2. 
If she erases 1, the nums array becomes [1, 2]. The bitwise XOR of all the elements of the chalkboard is 1 XOR 2 = 3. Now Bob can remove any element he wants, because Alice will be the one to erase the last element and she will lose. 
If Alice erases 2 first, now nums becomes [1, 1]. The bitwise XOR of all the elements of the chalkboard is 1 XOR 1 = 0. Alice will lose.
Notes: 
       1 <= N <= 1000. 
       0 <= nums[i] <= 2^16.
class Solution:
     def validTicTacToe(self, board):
         """
         :type board: List[str]
         :rtype: bool
         """
         cross = 0
         circle = 0
         for i in range(3):
             for j in range(3):
                 if board[i][j] == 'X':
                     cross += 1
                 if board[i][j] == 'O':
                     circle += 1
         if cross < circle or cross - circle > 1:
             return False
         cross_winning = 0
         circle_winning = 0
         for i in range(3):
             if board[i][0] == board[i][1] == board[i][2]:
                 if board[i][0] == 'X':
                     cross_winning += 1
                 elif board[i][0] == 'O':
                     circle_winning += 1
             if board[0][i] == board[1][i] == board[2][i]:
                 if board[0][i] == 'X':
                     cross_winning += 1
                 elif board[0][i] == 'O':
                     circle_winning += 1
         if board[0][0] == board[1][1] == board[2][2]:
             if board[0][0] == 'X':
                 cross_winning += 1
             elif board[0][0] == 'O':
                 circle_winning += 1
         if board[0][2] == board[1][1] == board[2][0]:
             if board[0][2] == 'X':
                 cross_winning += 1
             elif board[0][2] == 'O':
                 circle_winning += 1
                 
         if cross_winning > 0 and circle_winning > 0:
             return False
         if cross_winning > 0 and cross <= circle:
             return False
         if circle_winning > 0 and circle < cross:
             return False
         return True
class Solution:
     def validTicTacToe(self, board):
         """
         :type board: List[str]
         :rtype: bool
         """
         cross = 0
         circle = 0
         for i in range(3):
             for j in range(3):
                 if board[i][j] == 'X':
                     cross += 1
                 if board[i][j] == 'O':
                     circle += 1
         if cross < circle or cross - circle > 1:
             return False
         cross_winning = 0
         circle_winning = 0
         for i in range(3):
             if board[i][0] == board[i][1] == board[i][2]:
                 if board[i][0] == 'X':
                     cross_winning += 1
                 elif board[i][0] == 'O':
                     circle_winning += 1
             if board[0][i] == board[1][i] == board[2][i]:
                 if board[0][i] == 'X':
                     cross_winning += 1
                 elif board[0][i] == 'O':
                     circle_winning += 1
         if board[0][0] == board[1][1] == board[2][2]:
             if board[0][0] == 'X':
                 cross_winning += 1
             elif board[0][0] == 'O':
                 circle_winning += 1
         if board[0][2] == board[1][1] == board[2][0]:
             if board[0][2] == 'X':
                 cross_winning += 1
             elif board[0][2] == 'O':
                 circle_winning += 1
                 
         if cross_winning > 0 and circle_winning > 0:
             return False
         if cross_winning > 0 and cross <= circle:
             return False
         if circle_winning > 0 and circle < cross:
             return False
         return True