Python sol.based on iterative board-scan. [ With explanation ]
Python sol.based on iterative board-scan.\n\n\nclass Solution:\n    def validTicTacToe(self, board: List[str]) -> bool:\n        \n        rows, cols = [0] *3, 
Python sol.based on iterative board-scan.\n\n```\nclass Solution:\n    def validTicTacToe(self, board: List[str]) -> bool:\n        \n        rows, cols = [0] *3, [0]*3\n        \n        first_diag, second_diag = 0, 0\n        \n        turns = 0\n        \n        for y in range(3):\n            \n            for x in range(3):\n                \n                if board[y][x] == \'O\':\n                    # \'O\' on board[y][x]\n                    # \'O\' is on the second order of each play\n                    turns -= 1\n                    \n                    # update the existance counter of \'O\' of each possible line\n                    rows[y] -= 1\n                    cols[x] -= 1\n                    \n                    if y == x:\n                        first_diag -= 1\n                    \n                    if y + x == 2:\n                        second_diag -=1\n                \n                \n                elif board[y][x] == \'X\':\n                    # \'X\' on board[y][x]\n\n                    # \'X\' is on the first order of each play\n                    turns += 1\n                    \n                    # update the existance counter of \'X\' of each possible line\n                    rows[y] += 1\n                    cols[x] += 1\n                    \n                    if y == x:\n                        first_diag += 1\n                        \n                    if y + x == 2:\n                        second_diag +=1\n\n\n        # check the win state of \'X\'                        \n        win_of_x =  rows[0] == 3 or rows[1] == 3 or rows[2] == 3 or \\\n                    cols[0] == 3 or cols[1] == 3 or cols[2] == 3 or \\\n                    first_diag == 3 or second_diag == 3\n        \n        # check the win state of \'O\'\n        win_of_o =  rows[0] == -3 or rows[1] == -3 or rows[2] == -3 or \\\n                    cols[0] == -3 or cols[1] == -3 or cols[2] == -3 or \\\n                    first_diag == -3 or second_diag == -3\n        \n        \n        if ( win_of_x and turns == 0 ) or  ( win_of_o and turns == 1):\n            # \'X\' must win with first order, and \'O\' must win with second order\n            return False\n\n        else:\n            # \'X\' and \'O\' must take turns with each other.\n            # \'XX\' and \'OO\' is not allowed.\n            return turns == 0 or turns == 1\n```
['Python']