Hey is question me return type boolean kia aur phir return true ya false kr rhe hain

I think ye question return type void krke bhi normally theek hota bina changes ke…kyoonki return true ho ya false…hm steps to same hi perform kr rhe hain…

no actually there is a very good reason to use bool return value
let me explain
suppose you are at point a,b and you have to reach y,z , now return value true means that it is possible to reach y,z from a,b and false means its not , so at a,b you can reach only a+1,b and a,b+1 in one step so if you know, if it is possible to visit y,z from a+1,b or a,b+1 then you can say that we can reach y,z from a,b and to know this all we need to know is the value of solveMaze(a+1,b) and solveMaze(a,b+1) that’s it

you can try to solve the problem using return type void you will get what i am trying to say

After raising the doubt I did it by returning void…and got correct answer bro…

https://ide.geeksforgeeks.org/V8t1lhBvvv

This is link to my code…you can check…

@kaushikjatin, you raised the doubt under the topic rat in a maze so i was explaining based on this question but the code you sent is of n queen

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.