fix: sudoku_solve.cpp

This commit is contained in:
Panquesito7 2020-07-08 12:03:29 -05:00
parent 2502bd11b6
commit 13b5b9b829
No known key found for this signature in database
GPG Key ID: 3C482B03FD220E68

View File

@ -1,6 +1,6 @@
#include <iostream> #include <iostream>
bool isPossible(int *mat[][9], int i, int j, int no, int n) { bool isPossible(int mat[][9], int i, int j, int no, int n) {
/// Row or col nahin hona chahiye /// Row or col nahin hona chahiye
for (int x = 0; x < n; x++) { for (int x = 0; x < n; x++) {
if (mat[x][j] == no || mat[i][x] == no) { if (mat[x][j] == no || mat[i][x] == no) {
@ -23,7 +23,7 @@ bool isPossible(int *mat[][9], int i, int j, int no, int n) {
return true; return true;
} }
void printMat(int *mat[][9], int n) { void printMat(int mat[][9], int n) {
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) { for (int j = 0; j < n; j++) {
std::cout << mat[i][j] << " "; std::cout << mat[i][j] << " ";
@ -38,7 +38,7 @@ void printMat(int *mat[][9], int n) {
} }
} }
bool solveSudoku(int *mat[][9], int i, int j) { bool solveSudoku(int mat[][9], int i, int j) {
/// Base Case /// Base Case
if (i == 9) { if (i == 9) {
/// Solve kr chuke hain for 9 rows already /// Solve kr chuke hain for 9 rows already