This problem should have tags "Array" and "String" instead
The whole problem is about array and/or string manipulations. There is no Math or Recursion involved.\npython\nclass Solution:\n    # 20 ms, 99.25%. Time and Sp
The whole problem is about array and/or string manipulations. There is no Math or Recursion involved.\n```python\nclass Solution:\n    # 20 ms, 99.25%. Time and Space: O(1)\n    def validTicTacToe(self, board: List[str]) -> bool:\n        def winning(person, board):\n            if person*3 in board or person*3 in ("".join(col) for col in zip(*board)):\n                return True\n            if board[0][0] == board[1][1] == board[2][2] == person: return True\n            if board[0][2] == board[1][1] == board[2][0] == person: return True\n        \n        x = sum(row.count("X") for row in board)\n        o = sum(row.count("O") for row in board)\n        if winning("X", board) and winning("O", board): return False\n        if winning("X", board) and o + 1 != x: return False\n        if winning("O", board) and o != x: return False\n        if not 0 <= x - o <= 1: return False\n        return True\n```
['Python', 'Python3']