Pergunta de entrevista da empresa Hopscotch (India)

Modify an array such that the numbers are sorted according to their frequency in descending order.