Skip to content

Commit

Permalink
Improved task 1275
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev authored Apr 22, 2024
1 parent e25de96 commit b1558dd
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,22 @@ public String tictactoe(int[][] moves) {
private String wins(String[][] board) {
for (int i = 0; i < 3; i++) {
if (board[i][0] == null) {
break;
continue;
}
String str = board[i][0];
if (str.equals(board[i][1]) && str.equals(board[i][2])) {
return getWinner(str);
}
}

for (int j = 0; j < 3; j++) {
if (board[0][j] == null) {
break;
continue;
}
String str = board[0][j];
if (str.equals(board[1][j]) && str.equals(board[2][j])) {
return getWinner(str);
}
}

if (board[1][1] == null) {
return "";
}
Expand Down

0 comments on commit b1558dd

Please sign in to comment.