My easy to understand intuitive java solution
\tclass Solution {\n\t\n    public boolean validTicTacToe(String[] board) {\n         Character[][] arr = new Character[3][3];\n        int countX = 0, countO =
\tclass Solution {\n\t\n    public boolean validTicTacToe(String[] board) {\n         Character[][] arr = new Character[3][3];\n        int countX = 0, countO = 0;\n        for (int i = 0; i < 3; i++) {\n            for (int j = 0; j < 3; j++) {\n                if (board[i].charAt(j) == \'X\') {\n                    countX++;\n                }\n                if (board[i].charAt(j) == \'O\') {\n                    countO++;\n                }\n                arr[i][j] = board[i].charAt(j);\n            }\n        }\n        return isValid(arr, countX, countO);\n    }\n    \n    private static boolean isValid(Character[][] arr, int countX, int countO) {\n        return (countX == countO && !isXWinner(arr) && !isOWinner(arr)) ||\n                (countX == countO && isOWinner(arr) && !isXWinner(arr)) ||\n                (countX - countO == 1 && !isOWinner(arr) && !isXWinner(arr)) ||\n                (countX - countO == 1 && !isOWinner(arr) && isXWinner(arr));\n    }\n\n    private static boolean isXWinner(Character[][] arr) {\n        return (arr[0][0] == \'X\' && arr[0][1] == \'X\' && arr[0][2] == \'X\') ||\n                (arr[1][0] == \'X\' && arr[1][1] == \'X\' && arr[1][2] == \'X\') ||\n                (arr[2][0] == \'X\' && arr[2][1] == \'X\' && arr[2][2] == \'X\') ||\n                (arr[0][0] == \'X\' && arr[1][0] == \'X\' && arr[2][0] == \'X\') ||\n                (arr[0][1] == \'X\' && arr[1][1] == \'X\' && arr[2][1] == \'X\') ||\n                (arr[0][2] == \'X\' && arr[1][2] == \'X\' && arr[2][2] == \'X\') ||\n                (arr[0][0] == \'X\' && arr[1][1] == \'X\' && arr[2][2] == \'X\') ||\n                (arr[0][2] == \'X\' && arr[1][1] == \'X\' && arr[2][0] == \'X\');\n    }\n\n    private static boolean isOWinner(Character[][] arr) {\n        return (arr[0][0] == \'O\' && arr[0][1] == \'O\' && arr[0][2] == \'O\') ||\n                (arr[1][0] == \'O\' && arr[1][1] == \'O\' && arr[1][2] == \'O\') ||\n                (arr[2][0] == \'O\' && arr[2][1] == \'O\' && arr[2][2] == \'O\') ||\n                (arr[0][0] == \'O\' && arr[1][0] == \'O\' && arr[2][0] == \'O\') ||\n                (arr[0][1] == \'O\' && arr[1][1] == \'O\' && arr[2][1] == \'O\') ||\n                (arr[0][2] == \'O\' && arr[1][2] == \'O\' && arr[2][2] == \'O\') ||\n                (arr[0][0] == \'O\' && arr[1][1] == \'O\' && arr[2][2] == \'O\') ||\n                (arr[0][2] == \'O\' && arr[1][1] == \'O\' && arr[2][0] == \'O\');\n    }\n\n}
['Java']