title: Rearrange the elements of an array of integers(positive) to form a maximum resulting number
body: <p>It is an interview question. We have an array of positive integers and we have to rearrange and join the array elements so that the resulting number is maximum number that can be formed using this array.</p>
  
  <p>e.g.:</p>
  
  <pre><code>[884 88] -&gt; 88884
  
  [20 19 90] -&gt; 902019
  
  [909 90] -&gt; 90990
  </code></pre>
  
  <p>My Solution: I thought that sort the elements first by most significant digit(MSD) in decreasing order.</p>
  
  <p>i.e for 909 , 12, 88 we will have 909, 88, 12 after sorting and for those having same MSD sort second MSD and keep on doing this.</p>
  
  <p>So for array 909, 99 we will be having 99 and 909 and combine them.
  But for array 909, 90 we will have 90, 909, here is a catch since we have 90 common in both numbers so </p>
  
  <p>90</p>
  
  <p>909  ---> here two combination possible, since 90 is common so 9 is left after removing common part from 909, so I will check whether appending this 9 to 90 makes it larger. Here in this case appending 9 in front of 90 we have 990 which greater than 909 so 909 will be followed by 90. So the answer is 90990.</p>
  
  <p>But when I tried to code it I found it difficult to code because of too much complexity involved. Any suggestions?</p>