P21952 [GeeksforGeeks] Next optimal move in tic tac toe2842
提高-
题目描述

You are given a middle game situation of the game Tic Tac Toe. It is given that it is player "X's" turn and you need to give to most optimal position for the turn. The situation is given as a 3 x 3 character matrix board. '' refers to the place is empty. 'o' refers that player O marked it in his turn at some time and 'x' refers that player X marked it in his turn at some time. It is player X's turn. Tell him the most optimal solution.(Assume player O played first).
Example 1:
Input: board = {{o,
, },
{
, , },
{, , }}
Output: 1 1
Explaination: Placing a 'x' in the (1, 1)
that is the center of the board is the most
optimal approach for x.
Your Task:
You do not need to read input or print anything. Your task is to complete the function findBestMove() which takes board as input parameter and returns the best optimal move in a list where the first one is the row index and the second one is the column index.
Expected Time Complexity: O(2^{9})
Expected Auxiliary Space: O(1)
Constraints:
board[i][j] = 'o' / 'x' / '
'

输入格式

见题面

输出格式

见题面

样例输入
board = {{o, _, _}, {_, _, _}, {_, _, _}}
样例输出
1 1