C++ || 0ms || Easy and Case by Case Evaluation || a Little Long and Fully Commented.
\nclass Solution {\npublic:\nbool validTicTacToe(vector<string>& board) {\n        int playerOneMoves=0,playerTwoMoves=0;\n        for(int i=0; i<3; i++) {\n   
```\nclass Solution {\npublic:\nbool validTicTacToe(vector<string>& board) {\n        int playerOneMoves=0,playerTwoMoves=0;\n        for(int i=0; i<3; i++) {\n                for(int j=0; j<3; j++) {\n                        //check current char and increase the playerMove Count respectively\n                        char currentChar=board[i][j];\n                        if(currentChar==\' \')\n                                continue;\n                        currentChar==\'X\'?playerOneMoves++:playerTwoMoves++;\n                }\n        }\n\n        //This case can\'t happen in a valid game as playerOne is making the first move\n        if(playerTwoMoves>playerOneMoves)\n                return false;\n\n        //playerOne can be atmost 1 move ahead of playerTwo\n        if(playerOneMoves-1>playerTwoMoves)\n                return false;\n\n        //both have make equal number of moves to reach here.\n        //so last move would have been made by playerTwo and it would be valid only if playerOne hasn\'t won the game till that point.\n        if(playerOneMoves==playerTwoMoves) {\n                //for this to happen playerOne must not have win the game in previous moves\n                if(hasWon(\'X\',board)) return false;\n                return true;\n\n        }\n\n        //playerOne is 1 move ahead of playerTwo again that would only be possible if playerTwo hadn\'t won the game\n        //in this previous move.\n        if(playerOneMoves-1==playerTwoMoves) {\n                // for playerOne to make his most recent move playerTwo must not have won in previous moves\n                if(hasWon(\'O\',board)) return false;\n                return true;\n        }\n        return false;\n}\n\n// check is player has won the game or not.\nbool hasWon(char player,vector<string>&board){\n\n        int count=0;\n        //checking each row\n        for(int i=0; i<3; i++) {\n                int count=0;\n                for(int j=0; j<3; j++) {\n                        if(board[i][j]==player)\n                                count++;\n                }\n                if(count==3)\n                        return true;\n        }\n\n        //checking in coloumn\n        for(int i=0; i<3; i++) {\n                int count=0;\n                for(int j=0; j<3; j++) {\n                        if(board[j][i]==player)\n                                count++;\n                }\n                if(count==3)\n                        return true;\n        }\n\n        //check both diagnols\n        if(board[0][0]==player&&board[1][1]==player&&board[2][2]==player)\n                return true;\n\n        if(board[2][0]==player&&board[1][1]==player&&board[0][2]==player)\n                return true;\n\n        return false;\n}\n};\n\n```
['C', 'Matrix']