We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
Quote:
I think graph will help , but I am not sure about it .
If a graph can help, you should know why, otherwise it is a guess.
Look at the statements: you are in map at coordinates (a,b) and you need to reach coordinates (c,d) on each steps, you are only allowed 2 moves. Try to put this together.
For testing purpose, try to go from (1,2) to (8,13)
The path is (1,2) => (3,2) => (3,5) => (8,5) => (8,13)