From 00a8938dfa59ceb1656208a19a48aba4cfecc770 Mon Sep 17 00:00:00 2001 From: Ninad2003 <138314895+Ninad2003@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:31:42 +0530 Subject: [PATCH] Create 37SudokuSolver.cpp --- Solutions/37SudokuSolver.cpp | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Solutions/37SudokuSolver.cpp diff --git a/Solutions/37SudokuSolver.cpp b/Solutions/37SudokuSolver.cpp new file mode 100644 index 0000000..624c401 --- /dev/null +++ b/Solutions/37SudokuSolver.cpp @@ -0,0 +1,46 @@ +class Solution { +private: + bool helpmeValid(vector>& board, int row, int col, char x) + { + for(int i=0;i<9;i++) + { + if (board[i][col] == x) return false; + if (board[row][i] == x) return false; + + //formula: + if (board[3 * (row/3) + i/3][3 * (col/3) + i%3] == x) return false; + } + return true; + } + + + bool helpme(vector>& board) + { + for (int i=0;i>& board) + { + helpme(board); + } +};