title: Finding least difference between max and min value of all possible sets of numbers
body: <p>There are <em>n</em> arrays of <em>k</em> size each.</p>
  
  <pre><code>a0[0],a0[1],......a0[k-1]
  a1[0],a1[1],......a1[k-1]
  .
  .
  .
  an-1[0],an-1[1], .... an-1[k-1]
  </code></pre>
  
  <p>There are no duplicates at all and all the arrays are sorted. </p>
  
  <p>Now a Set of size <em>n</em> is constructed by taking any value randomly from each of the arrays.
  e.g one such set can be <code>{a0[0],a1[3],a2[2],.... an-1[k-1]}</code>.</p>
  
  <p>My goal is to find out the min and max elements in all possible Sets such that the difference between the min and max is the lowest.</p>
  
  <p>Example (k=3,n=3)</p>
  
  <pre><code>[3 7 11]
  [1 12 15]
  [4 19 21]
  </code></pre>
  
  <p>So mathematically there will be 27 such sets</p>
  
  <pre><code>(3 1 4) (3 12 4) (3 15 4)
  (3 1 19) (3 12 19) (3 15 19)
  (3 1 21) (3 12 21) (3 15 21)
  
  (7 1 4) (7 12 4) (7 15 4)
  (7 1 19) (7 12 19) (7 15 19)
  (7 1 21) (7 12 21) (7 15 21)
  
  (11 1 4) (7 12 4) (11 15 4)
  (11 1 19) (7 12 19) (11 15 19)
  (11 1 21) (7 12 21) (11 15 21)
  </code></pre>
  
  <p>After computing min and max values of all these sets we can conclude that (3 1 4) is the set for which difference between min (1) and max (4) is the global minimum or lowest.</p>
  
  <p>So we will output 3 as the global minimum difference and the corresponding pair which is (3 4). If there are multiple global minima then print them all. Please suggest the algorithm with better time and space complexity. We can't go for brute force approach.</p>