I am stuck in this SPOJ question. Can anyone please point out as to where I am going wrong ? I am not even getting the sample test cases correct..
Here's the link to the question :
http://www.spoj.com/problems/ADDAP/
And here's my solution for it. I am using BFS to detect the level of the nodes, but unfortunately not getting the correct answer.