please help me in following problem , i tried to read its analysis ,but was unable to understand its optimised solution . I looked for various people solution ,they had used bfs, but i am unable to interpret that too.
Just give me the way ,through which i should approach this problem .