title: How to find the shortest path in a maze with checkpoints?
body: <p>I am working on a shortest maze problem, and there is a start point, an end point and some checkpoints which the traveller must pass at least once. '#' means the wall, '.' means the road, 'P' means the checkpoint. </p>
  
  <p>I was thinking about finding the neareast checkpoint from the end point, and keep looking for those unvisited checkpoint from current checkpoint until all the checkpoint are visited. Finally looking for the shortest path to the start point. </p>
  
  <p>But it doesn't seem good, I mean, it looks like just a greedy algorithm which doesn't make sure you get the best solution. Should I use Knapsack algorithm when judging which checkpoint to go? </p>