mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
@ -341,7 +341,7 @@ class Solution {
|
|||||||
|
|
||||||
public boolean isValid(int row, int col, int n, char[][] chessboard) {
|
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') {
|
if (chessboard[i][col] == 'Q') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user