mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 08:16:50 +08:00
Dynamic-Programming : remove live code & console.log, leave examples as comments.
This commit is contained in:
@ -1,14 +1,3 @@
|
||||
const _board = [
|
||||
['.', '9', '.', '.', '4', '2', '1', '3', '6'],
|
||||
['.', '.', '.', '9', '6', '.', '4', '8', '5'],
|
||||
['.', '.', '.', '5', '8', '1', '.', '.', '.'],
|
||||
['.', '.', '4', '.', '.', '.', '.', '.', '.'],
|
||||
['5', '1', '7', '2', '.', '.', '9', '.', '.'],
|
||||
['6', '.', '2', '.', '.', '.', '3', '7', '.'],
|
||||
['1', '.', '.', '8', '.', '4', '.', '2', '.'],
|
||||
['7', '.', '6', '.', '.', '.', '8', '1', '.'],
|
||||
['3', '.', '.', '.', '9', '.', '.', '.', '.']
|
||||
]
|
||||
|
||||
const isValid = (board, row, col, k) => {
|
||||
for (let i = 0; i < 9; i++) {
|
||||
@ -43,8 +32,18 @@ const sudokuSolver = (data) => {
|
||||
}
|
||||
|
||||
// testing
|
||||
(() => {
|
||||
if (sudokuSolver(_board)) {
|
||||
console.log(_board)
|
||||
}
|
||||
})()
|
||||
|
||||
// const board = [
|
||||
// ['.', '9', '.', '.', '4', '2', '1', '3', '6'],
|
||||
// ['.', '.', '.', '9', '6', '.', '4', '8', '5'],
|
||||
// ['.', '.', '.', '5', '8', '1', '.', '.', '.'],
|
||||
// ['.', '.', '4', '.', '.', '.', '.', '.', '.'],
|
||||
// ['5', '1', '7', '2', '.', '.', '9', '.', '.'],
|
||||
// ['6', '.', '2', '.', '.', '.', '3', '7', '.'],
|
||||
// ['1', '.', '.', '8', '.', '4', '.', '2', '.'],
|
||||
// ['7', '.', '6', '.', '.', '.', '8', '1', '.'],
|
||||
// ['3', '.', '.', '.', '9', '.', '.', '.', '.']
|
||||
// ]
|
||||
// sudokuSolver(board) // -> board updated by reference
|
||||
|
||||
export { sudokuSolver }
|
||||
|
Reference in New Issue
Block a user