Sir, please help me to find out my mistake in my code
sir, i have a doubt at every step. when we have to return true or false. iām very confused. please sir tell me.
in line no. 44 and 58, what will be happen. if iāll return false.
here for this prblem true or false indicates wheter we are able to solve sudoku successfully or not.
so when we hit base case that indicate that we have solved the sudoku succesfully.
so return true.
but if u want to print all possible solution of sudoku then return false,
false will indicate that sudoku is not solved yet ,so it will try other ways as well and becuase u are every time returning false, it will try all psossible ways of solving sudoku
sir, can u please give me your contact. i have some conceptual doubts, due to which iām getting problems in questions, i cant express my doubts here in written form. please sir, your contactā¦
sry bro , i cant , its not possible to take students doubt on call.
u can write in hindi , if u r more comfortable in that
1st doubt - In line 49 and 52, ydi mai āreturnā use na kru dur directly āsolvesudokuāfunction ko call kru to TLE kyo de rha hai? 2nd doubt - In line 58,59 and 60, what is the mean of it (if(solvesudoku(a,i,j+1,n)==true){ return true; } ) Mai iss function ko directly call kyo nhi kar skta like āsolvesudoku(a,i,j+1,n)ā
agar tum return use nahi karoge , aur direclty solvesudoku call kardoge
to sabse pehel to ye function call ho jayega.
aur phir jab is call ka execution khatam ho jayega ,uska baad condtrol phir se if ke paas aa jayega
aur uske baad waali saari line phir se execute hone lagengi, jo ki hum nahi chahte qunki j ki value n hai .
yaha pe hum function call kar ke uske baad jo value aayi hai wo check kar rahe hai.
agar true hai to iska matlab ki hamara sudoku solve ho chuka hai.
to phir koi aur step try karne ki jarurat nahi hai sidha yaha se bhi true return kar do
otherwise koi aur value try karo.
direct likne me hum ye check nahi kar payenge ki sudoku solve hua ya nahi.
thank you sir, i got it.
I hope Iāve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.