title: Interview puzzle: array size-n contains numbers from [i, i + n)
body: <p>Given an unsorted array of numbers, write a function that returns true if array consists of consecutive numbers.</p>
  
  <p>Examples:</p>
  
  <ol>
  <li><p>If array is {5, 2, 3, 1, 4}, then the function should return true because the array has consecutive numbers from 1 to 5.</p></li>
  <li><p>If array is {83, 78, 80, 81, 79, 82}, then the function should return true because the array has consecutive numbers from 78 to 83.</p></li>
  <li><p>If the array is {34, 23, 52, 12, 3 }, then the function should return false because the elements are not consecutive.</p></li>
  <li><p>If the array is {7, 6, 5, 5, 3, 4}, then the function should return false because 5 and 5 are not consecutive.</p></li>
  </ol>
  
  <p>I came up with the following algo:</p>
  
  <ol>
  <li><p>find the max and min of the array</p></li>
  <li><p>max-min+1 should be the size of array</p></li>
  <li><p>check for duplicates</p></li>
  <li><p>check for all consecutive numbers in between</p></li>
  </ol>
  
  <p><strong>How can I achieve the 4th path?</strong> (The complexity should be <code>O(n)</code>)</p>
  
  <p>Other suggestions are most welcome.</p>