title: How to sort a list with given range in O(n)
body: <p>If I have a list of size n and I know that the numbers in the list will be between 1 and 2n how would I go about solving it where the worst case would be O(n)?</p>
  
  <p>I was thinking that if it was between 1 and n I could just take the number and swap it with the value of the array at that number - 1 but then it wouldn't sort if there were any duplicate. </p>
  
  <p>I was thinking of a similar approach for the list having number between 1 and 2n but I can't seem to figure it out. Any help please?</p>