Function
backTrack
(
board,
n,
row,
col,
colSet,
posDiagSet,
negDiagSet,
moves,
)
Source from the content-addressed store, hash-verified
| 39 | }; |
| 40 | |
| 41 | const backTrack = ( |
| 42 | board, |
| 43 | n, |
| 44 | row, |
| 45 | col, |
| 46 | colSet, |
| 47 | posDiagSet, |
| 48 | negDiagSet, |
| 49 | moves, |
| 50 | ) => { |
| 51 | colSet.add(col); |
| 52 | posDiagSet.add(row + col); |
| 53 | negDiagSet.add(row - col); |
| 54 | board[row][col] = 'Q'; |
| 55 | |
| 56 | dfs(board, n, colSet, posDiagSet, negDiagSet, row + 1, moves); |
| 57 | |
| 58 | colSet.delete(col); |
| 59 | posDiagSet.delete(row + col); |
| 60 | negDiagSet.delete(row - col); |
| 61 | board[row][col] = '.'; |
| 62 | }; |
Tested by
no test coverage detected