Skip to content

Commit dd261c0

Browse files
Merge pull request youngyangyang04#657 from xsduan98/master
第51题.N皇后 修改Java代码
2 parents 5b31add + e419a5f commit dd261c0

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
@@ -341,7 +341,7 @@ class Solution {
341341

342342
public boolean isValid(int row, int col, int n, char[][] chessboard) {
343343
// 检查列
344-
for (int i=0; i<n; ++i) {
344+
for (int i=0; i<row; ++i) { // 相当于剪枝
345345
if (chessboard[i][col] == 'Q') {
346346
return false;
347347
}

0 commit comments

Comments
 (0)