Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eb61567

Browse files
Refactor: Change loop variable type from int to char for clarity
Updated the loop variable in the DFS function from `int k` to `char k` to improve clarity and maintain consistency with the Sudoku board's data type. This change avoids implicit type conversions and ensures that the code directly represents the intended operations on character data ('1' to '9').
1 parent 75207ee commit eb61567

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎DFS/037.Sudoku-Solver/037.Sudoku-Solver.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Solution {
1111
if (j==9) return DFS(board, i+1, 0);
1212
if (board[i][j]!='.') return DFS(board, i, j+1);
1313

14-
for (int k='1'; k<='9'; k++)
14+
for (char k='1'; k<='9'; k++)
1515
{
1616
if (!isValid(board, i, j, k)) continue;
1717
board[i][j]=k;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /