From abd0fa3dcb29ecf6d52592f58af67df04a2bc221 Mon Sep 17 00:00:00 2001 From: amavor <31956811+amavor@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:20:33 +1000 Subject: [PATCH] Update 1275 Find Winner on a Tic Tac Toe Game Tic Tac Toe solution used `break` inside a loop when the first cell of the column or row was empty. I believe this will result in it skipping all other rows/columns when it reaches a null cell. Instead of using `break` I think it should be `continue` instead. Tested locally and `continue` works for 3 vertical in the last column, where `break` fails to find the winner. --- .../s1275_find_winner_on_a_tic_tac_toe_game/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/g1201_1300/s1275_find_winner_on_a_tic_tac_toe_game/readme.md b/src/main/kotlin/g1201_1300/s1275_find_winner_on_a_tic_tac_toe_game/readme.md index 11d8dc0a..7a40e674 100644 --- a/src/main/kotlin/g1201_1300/s1275_find_winner_on_a_tic_tac_toe_game/readme.md +++ b/src/main/kotlin/g1201_1300/s1275_find_winner_on_a_tic_tac_toe_game/readme.md @@ -78,7 +78,7 @@ class Solution { private fun wins(board: Array>): String { for (i in 0..2) { if (board[i][0] == null) { - break + continue } val str = board[i][0] if (str == board[i][1] && str == board[i][2]) { @@ -87,7 +87,7 @@ class Solution { } for (j in 0..2) { if (board[0][j] == null) { - break + continue } val str = board[0][j] if (str == board[1][j] && str == board[2][j]) { @@ -111,4 +111,4 @@ class Solution { } } } -``` \ No newline at end of file +```