Python3   ||    int array, 7 lines, w/ explanation  ||    T/S: 99%/ 99%
The two criteria for a valid board are:\n1. num of Xs - num of Os is 0 or 1\n1. X is not a winner if the number of moves is even, and O is not a winner if the n
The two criteria for a valid board are:\n1. num of *X*s - num of *O*s is 0 or 1\n1. *X* is not a winner if the number of moves is even, and *O* is not a winner if the number of moves is odd.\n```\nclass Solution:\n    def validTicTacToe(self, board: List[str]) -> bool:\n\n        d = {\'X\': 1, \'O\': -1, \' \': 0}               # transform the 1x3 str array to a 1x9 int array\n        s = [d[ch] for ch in \'\'.join(board)]        # Ex: ["XOX"," X ","   "] --> [1,-1,1,0,1,0,0,0,0]\n        sm = sum(s)\n\n        if sm>>1: return False                                      # <-- criterion 1\n        \n        n = -3 if sm == 1 else 3                                    # <-- criterion 2.\n        if n in {s[0]+s[1]+s[2], s[3]+s[4]+s[5], s[6]+s[7]+s[8], \n                 s[0]+s[3]+s[6], s[1]+s[4]+s[7], s[2]+s[5]+s[8],         # the elements of the set are \n                 s[0]+s[4]+s[8], s[2]+s[4]+s[6]}: return False           # the rows, cols, and diags\n        \n        return True                                                 # <-- both criteria are true\n```\n\n[https://leetcode.com/problems/valid-tic-tac-toe-state/submissions/1272641877/](https://leetcode.com/problems/valid-tic-tac-toe-state/submissions/1272641877/)\n\nI could be wrong, but I think that time complexity is *O*(1) and space complexity is *O*(1)because the board is fixed.
['Python', 'Python3']