Skip to content

Commit e419a5f

Browse files
committed
第51题.N皇后 修改Java代码
1 parent 5a467c2 commit e419a5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

problems/0051.N皇后.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class Solution {
332332

333333
public boolean isValid(int row, int col, int n, char[][] chessboard) {
334334
// 检查列
335-
for (int i=0; i<n; ++i) {
335+
for (int i=0; i<row; ++i) { // 相当于剪枝
336336
if (chessboard[i][col] == 'Q') {
337337
return false;
338338
}

0 commit comments

Comments
 (0)