title: Reorder Array of Red, Blue and Green balls
body: <p>In one of my interviews the interviewer asked me - 
  An array of some size contains Red, Blue and Green balls all mixed up randomly. 
  like RGBBBRRGGG, where RGB is for Red, Green and Blue.</p>
  
  <p>What is the most optimal way to end up with an array like- RRRRGGGGBBBB
  i.e. all R's, all G's and all B's together.</p>
  
  <p>I proposed converting all Red, Blue, Green to their ASCII values and then running the most efficient sorting algorithm on it. 
  But he wasn't impressed . Any other more efficient solution to this problem ? with lowest space and time complexity ?</p>