Ouch. That’s very misleading.
For this question, if |S| \neq |T|, the answer is no, right?
Yep. Directly "NO.
This got accepted, but this is a slightly different dfs logic. However, I’d like to find out why the bool dfs()
version was failing.
Haha, that’s the exact train of thought that I went through. But you can change ‘a’ to ‘b’, even if there is no direct mapping. Like, it’s still possible if we have a->t and t->b maps. Hence, dfs.
Yes, I missed that.
The problem with this code is if |S| \neq |T|, your function doesn’t take in m and the mappings because you return nothing from the function immediately. This input gets piled up and goes to the next test cases where your program gets messed up.
ARGHHHHHHHHHHHH! I cannot believe I did this again. You have a really good eye! Thank you so much!
I can sleep in peace. AC.
I was also not clearing the adjacency list by returning immediately.
Sleep well XD
i have checked length after in putting mappings
Can you post your submission link? It’s hard to see what you’ve done here.
got any thing
i have done the same thing
i got the mistake bro
it is intialising visted =0;in the following line
if(!dfs(a[i]-‘a’)){decide=1;break;}
Cool.
hello bro how u solved covid sampling question in june long can you explain me