Am I going correct in this Question?
Please tell if you find any Logical Mistake in this or any other error.
Question Pic I am attacthing
Am I going correct in this Question?
Please tell if you find any Logical Mistake in this or any other error.
Question Pic I am attacthing
hello @cbcao263
ha bhai sahi ja rahe ho.
some optimisation->
a)map se badhiya ek 3d matrix bana lete given info store karne ke liye.
mat[N][M][5] size ki
b) agar ek path se true return ho gya hai to phir baaki mat check karo sidha true return kar do
Okayy bro Thnx
Okayy
Map se krrha usse ek baar try krke submit krdu
College Assignment hain yeh isliye
Fr Matrix se bhi try krta hu
Vaise Map ka jyada fayda nhi hoga
Direct Access hojayega
But wo ton yaar Matrix mein bhi hojayega
Fayda kya hoga vaise To use Matrix than Map
2nd Krke dekhta hu
matrix thoda fast rahega map se
Okayy
Kaafi shi rhega fir ton
bhai yeh kuch errors remove kiye
Yeh Scope ke kya errors derha
Iske liye Base Case mein return true ki jgah return false krdu
Chlega na?
nahi base case mein return true is rahega.
check now->
ek visited array aur rakhna padega takki infinite circle mein na phase .
ek baar rat chases its cheese problem solve karo ,phir ye karna
Rate chases its cheese
Same Problem nhi hai
Rate in a maze jaisi
Abhi dekha
Difference is usme ek print krwaana pdega
ND For that,
yaar mene Base Case mein ek baar print krwaadiya
Agar Multiple Print krwaane hain fir false krnaa pdega right?
Jaisa N Queen mein kiya tha
agar ek baar print karwana hai to true rakna hota hai , multiple ke liye false
infinite recursion ki wajah se. isko solve karne ke liye visited array rakhni padegi aur.
isiliye bol raha hu ek bar rat chases its cheese revise kar lo
Bhaiyeh ton direct isse hogya tha
bas 1 test case nhi pass kiya tha
Fir isme bhi Same Modifications lgaani pdegi kya
!down
!right waali
wo sol matrix isme bhi lagegi.
ha ye laga sakte ho thoda time kam lagega phir
Ab shi hai?..
Hogya tha Bhai
Thanks a lot
Ab Kuch doubts clear krdo
Yeh solved kyu liya
Jab mene element pehle hi i*n+j+1 se krliya tha
isliye solved kahe kiya
solved bus ye store kar raha hai ki current path tak hum kis kis cell se ho ke aaye hain.
isko hum use kar rahe hain taaki koi bhi cell ek sa jayda baar na visit ho path find ke dauran.
isiliye hum agar kisi cell be jaa rahe hai jaha sol[i][j] 1 hai to waha se hum false return kar rahe hai ,kyunki wo already hum pehle include kar chuke hain.
aur infinite cycle bhi avoid hoga
Okayyy Bro
Thanks a lot
Bhut Acha smjhaadiya
Thanks a lot