mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 11:34:46 +08:00
第51题.N皇后 修改Java代码
This commit is contained in:
@ -332,7 +332,7 @@ class Solution {
|
||||
|
||||
public boolean isValid(int row, int col, int n, char[][] chessboard) {
|
||||
// 检查列
|
||||
for (int i=0; i<n; ++i) {
|
||||
for (int i=0; i<row; ++i) { // 相当于剪枝
|
||||
if (chessboard[i][col] == 'Q') {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user