2
* Here is my solution :4
* <p>Time Complexity O(M) Space Complaexity O(1)7
public String tictactoe(int[][] moves) {9
int[][] rcd = new int[3][3]; // rcd[0] --> rows , rcd[1] --> columns , rcd[2] --> diagonals11
for (int turn = 0; turn < moves.length; turn++) {18
rcd[0][moves[turn][0]] += AorB;19
rcd[1][moves[turn][1]] += AorB;21
if (moves[turn][0] == moves[turn][1]) {24
if (moves[turn][0] + moves[turn][1] - 2 == 0) {28
if (Math.abs(rcd[0][moves[turn][0]]) == 329
|| Math.abs(rcd[1][moves[turn][1]]) == 330
|| Math.abs(rcd[2][0]) == 331
|| Math.abs(rcd[2][1]) == 3) {33
return AorB == 1 ? "A" : "B";37
return moves.length == 9 ? "Draw" : "Pending";