Easy to Understand
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def validTicTacToe(self, board: List[str]) -> bool:\n        def checkWinState(board_):\n            val_x = 0\n            val_o = 0\n            for i in range(3):\n                if board_[i][0] == board_[i][1] and board_[i][1] == board_[i][2] and board_[i][0] != " ":\n                    if board_[i][0] == "X":\n                        val_x += 1\n                    else:\n                        val_o += 1\n\n                if board_[0][i] == board_[1][i] and board_[1][i] == board_[2][i] and board_[0][i] != " ":\n                    if board_[0][i] == "X":\n                        val_x += 1\n                    else:\n                        val_o += 1\n                \n            if board_[0][0] == board_[1][1] and board_[1][1] == board_[2][2] and board_[0][0] != " ":\n                if board_[0][0] == "X":\n                    val_x += 1\n                else:\n                    val_o += 1\n\n            if board_[0][2] == board_[1][1] and board_[1][1] == board_[2][0] and board_[2][0] != " ":\n                if board_[2][0] == "X":\n                    val_x += 1\n                else:\n                    val_o += 1\n            \n            return val_x, val_o    # returns (how many times x won, how many times o won)\n \n        arr = []    #total entry on board\n        for i in range(3):\n            for j in range(3):\n                if board[i][j] != " ":\n                    arr.append(board[i][j])\n        if len(arr) == 0:\n            return True   #If no entry then valid board\n        elif len(arr) == 1:\n            if arr[0] == "X":\n                return True  #if 1st entry is X then valid else not valid\n            else:\n                return False\n        else:\n            x = 0    #number of x in board\n            o = 0    #number of o in board\n            for i in arr:\n                if i == "X":\n                    x += 1\n                else:\n                    o += 1\n            if abs(x-o) > 1:\n                return False\n            elif o > x:\n                return False\n            else:\n                win_x = checkWinState(board)[0]   #number of times X wins \n                win_o = checkWinState(board)[1]   #number of times O wins \n\n                if win_x > 2 or win_o > 2: #If any of them wins more that 2 times then invalis\n                    return False\n                elif (win_x) > 0 and (win_o) > 0: # if both of them win then Invalid\n                    return False\n                elif (win_x) > 0 and win_o == 0 and x == o : #if x wins but the number o is same as x then invalid\n                    return False\n                elif win_o > 0 and win_x == 0 and o < x: #if O wins but the number of O is less than X then Invalid\n                    return False\n                else:\n                    return True  #every condition except these are Valid\n\n        \n```
['Matrix', 'Python', 'Python3']