Java Simple and easy to understand solution, O(1)0 ms, faster than 100.00%,
PLEASE UPVOTE IF YOU LIKE THIS SOLUTION\n\n\nclass Solution {\n    public boolean validTicTacToe(String[] board) {\n        int[] counts = getCounts(board);\n  
**PLEASE UPVOTE IF YOU LIKE THIS SOLUTION**\n\n```\nclass Solution {\n    public boolean validTicTacToe(String[] board) {\n        int[] counts = getCounts(board);\n        \n        int xCount = counts[0];\n        int oCount = counts[1];\n        \n        //X count must be equal to O count/ O count + 1\n        if(!(xCount == oCount || xCount == oCount + 1)) return false;\n        \n        //when X is winner, then X count must equal to O count + 1\n        //if not retunr false\n        if(isWinner(board, \'X\') && xCount != oCount + 1) return false;\n        \n        //when O is winner, then X count must equal to O count\n        if(isWinner(board, \'O\') && xCount != oCount) return false;\n        \n        return true;\n    }\n    \n    private boolean isWinner(String[] board, char c){\n        \n        //horizonal\n        for(int i = 0; i < 3; i++){\n            if(board[i].charAt(0) == c && board[i].charAt(1) == c  && board[i].charAt(2) == c) \n                return true;\n        }\n        \n        //Vertical\n        for(int i = 0; i < 3; i++){\n            if(board[0].charAt(i) == c && board[1].charAt(i) == c  && board[2].charAt(i) == c) \n                return true;\n        }\n        \n        //doagonal\n        if(board[0].charAt(0) == c && board[1].charAt(1) == c  && board[2].charAt(2) == c) \n                return true;\n         \n        //anti diagonal\n        if(board[0].charAt(2) == c && board[1].charAt(1) == c  && board[2].charAt(0) == c) \n                return true;\n        \n        return false;\n        \n    }\n    \n    private int[] getCounts(String[] board){\n        int x = 0; // X count\n        int o = 0; // Y Count \n        \n        for(int i = 0; i < 3; i++){\n            \n            for(int j = 0; j < 3; j++){\n                char c = board[i].charAt(j);\n                if(c == \'X\'){\n                    x++;\n                }else if(c == \'O\'){\n                    o++;\n                }\n            }\n        }\n        \n        return new int[]{x, o};\n    } \n}\n```
[]