I am not able to understand where I am going wrong in the following code , so please help me in it
@harshulgarg21 in ur parent map, in ur code u were making dist[i.first]=INT_MAX, here i.first can never be 36 since 36 is not a parent node.so when u were comparing dist[neighbour]==INT_MAX, dist[36]=0 hencewas never pushed in queue.
Hence its parent was never defined.
So, try making dist[ 1 to 42]=INT_MAX and try running ur code.
Hope this resolves your doubt.
I am not getting the right ans after making the necessary modifications. Can you please omit in my code.
@harshulgarg21 if I will do this you will not be able to learn and even your program in future. Because you are very close to the answer I would recommend that you should yourself Debug this
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.