Pergunta de entrevista da empresa OYO

Sort an array based on frequency of its elements.