my code is giving me TLE. please tell me what I am doing wrong
TLE and wrong answer
so my logic ic correct ?
yeah in the problem u need to apply bfs only

in place of u it should be v.
also in place of x it should be m
rest everthing looks correct to me
Hey, i made some changes to your code.
It is working now.