you mean dfs , the complexity will go very high ,as in a call we will calc moves to if we started swap from some index ,then we will try for other,and everytime for a call it will solve completely ,and then we will compare min of all , here bfs is a lot bettter
bawa ji explained well but, coding mein bhand mar diya apny 😂. instead of detecting possible moves at time of execution you have add it in static fashion
correct code in c++ class Solution { public: int slidingPuzzle(vector& board) { queueq; string tar="123450"; int r=board.size(); int c=board[0].size(); string act=""; for(int i=0;i
If you also want doubt support, you can consume same content on nados.pepcoding.com and a social media feed where your doubts will be taken care of. It is entirely free of charge.
difficult questions become easy if done with pepcoding :)
exactly
This is a google question
Similar to AI 8 puzzle problem using heuristic value and informed search technique
Sir hm direct agr vector ko set me store kra le to used is method see jyada TC aayega kya?
Thank you sir for such a wonderful explanation 😄
time complexity kya hogi iski...O(n*m) ????
amazing explaination ,question boht easy bna diya sir aapne
is backtracking the option
you mean dfs , the complexity will go very high ,as in a call we will calc moves to if we started swap from some index ,then we will try for other,and everytime for a call it will solve completely ,and then we will compare min of all , here bfs is a lot bettter
Thanks, sir.Amazing expalnation
Ye graph k questions dp k memorization ki tarah lag rahe...btw best explanation🔥✨
For better experience, visit nados.io, where you will get well curated content and career opportunities.
memoization
hatsoff
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
bawa ji explained well but, coding mein bhand mar diya apny 😂. instead of detecting possible moves at time of execution you have add it in static fashion
correct code in c++
class Solution {
public:
int slidingPuzzle(vector& board)
{
queueq;
string tar="123450";
int r=board.size();
int c=board[0].size();
string act="";
for(int i=0;i
If you also want doubt support, you can consume same content on nados.pepcoding.com and a social media feed where your doubts will be taken care of.
It is entirely free of charge.