title: Shortest path between two points through N checkpoints in a matrix
body: <p>How to find shortest path between two points, namely S and D, in a matrix ? It should pass through multiple checkpoints named &amp;. It cannot pass through G. * represents an open gate. Paths can pass through destination and checkpoints any number of times.</p>
  
  <p>Example:  </p>
  
  <blockquote>
    <blockquote>
  <pre><code>GGGGG
  GS**G  
  GGDGG  
  G**&amp;G  
  GGGGG
  </code></pre>
    </blockquote>
  </blockquote>
  
  <p>Output for this matrix should be 6.</p>