Help me out in this problem
Use unordered map instead of map
In line 15 add return
What is your search function doing if it’s returning nothing?
Are you using BFS or DFS in this problem?
@mr.encoder there is no need of search because target node is there
i am using bfs plus visited set to keep track of nodes n which are already visited
@mr.encoder in line 90 it is giving error kindly check on your system then better you can understand it??
I just wanted to know that what your search function is doing,
Moreover are you trying to build a graph and then running a bfs on it?
@mr.encoder i used hashedmap to store parent of each node and run bfs to find node at required level as per given question??
Lemme debug it and send you the correct code. Be patient till then.
Share your updated code of unordered map with me asap.
What was the error in your code?
@mr.encoder when i was pushing the parent of current node then i didnot consider the case it may be null?
Please don’t forget to mark your doubt as resolved.
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.