Tic-Tac-Toe Game Over
Problem statement
You are given an n × n tic-tac-toe board encoded as n strings. Cells contain 'X', 'O', or '.' for empty.
Return true if the game is over: either one player fills an entire row, column, main diagonal, or anti-diagonal, or the board is full and has no winner. Otherwise return false.
Function
gameOver(board: String[]) → booleanExamples
Example 1
board = ["XXX","O.O","..O"]return = trueX fills the first row.
Example 2
board = ["XO","OX"]return = trueThe board is full, so the game ended even without considering another move.
Constraints
1 <= n <= 500.- Every row has length
nand uses onlyX,O, and..