title: Check if matrix elements are continuous
body: <p>I've been trying to solve this for days and I haven't been able to solve it.</p>
  
  <p>I need to check if elements in a matrix are continuous or not. For example:</p>
  
  <pre><code>1 0 1 0 0 0
  0 1 0 0 1 0
  0 0 1 1 0 0
  </code></pre>
  
  <p>In this case, the 1 are connected because they are continuous.</p>
  
  <p>Check this example:</p>
  
  <pre><code>1 0 0 0 1
  0 1 0 0 1
  1 0 0 0 1
  0 0 1 0 0
  </code></pre>
  
  <p>In this case, the 1 are not continuous because they are not connected.
  As you can see, the matrix size varies.</p>