Nium interview question

Reverse Cyclic sort (Hard Question)