Since thee problem asks for the minimum number of jumps, a BFS suffices.