title: Partition a sorted list subject to a constraint
body: <p><strong>Here is the question:</strong></p>
  
  <p>Given a sorted list of say Integers (you can assume they are positive, if its makes the problem any simpler), partition the list into 'n' equal size partitions (or as equal as possible), subject to the constraint that none of the integers appears more than one such partition.</p>
  
  <p>The constraint essentially means that if you have a list 
  {1,1,2,2}</p>
  
  <p>then all the ones have to be in the same set, and all the 2's have to be in the same set. All 1's and all 2's can be in one set too. But we can't have one of the 1's in first partition and the second 1 in the second partition.</p>
  
  <p><strong>Example 1:</strong>
  <code></p>
  
  <pre><code>    List: {1,1,2,2,3,3,4,4}
  
  
      Number of partitions to make: 4
  
      Answer: {1,1} {2,2} {3,3} {4,4}
  </code></pre>
  
  <p><strong>Example 2: (trickier one)</strong>
  </p>
  
  <pre>List: {1,1,2,2,2,3,3,4,4,4,4,4,4,4,4} 
  
  Number of partitions to make : 3
  
  Answer: {1,1,2,2} {3,3} {4,4,4,4,4,4,4,4}
  
      OR: {1,1} {2,2,3,3} {4,4,4,4,4,4,4,4}
  </code></pre>
  
  <p><strong>Note</strong> here that the 3rd partition has to be of size 8, because due to the constraint all the 4's have to be in the same partition.</p>
  
  <p>There can be numerous other tricky cases. Let me know if anyone needs more examples.</p>
  
  <p>So the questions is what is the best way to approach or solve this problem?</p>