https://www.codechef.com/problems/KJCP01

can anyone explain me how to solve this question using normal data structure not by making cmp fxn and passing that to sort fxn.