Solution to path finder problem.