title: How to get all sub arrays of an array of length 2 or more in efficient way?
body: <pre><code>array =[1,2,3,4]
  </code></pre>
  
  <p>Resulting subarray should be...</p>
  
  <pre><code>[1,2],[2,3],[3,4],[1,2,3],[2,3,4],[1,2,3,4]
  </code></pre>