Yesterday there was a online test of some website (GeeksforGeeks) where I encountered the below problem, I was not successful in getting AC for the problem because of TLE issue, it will be very help if someone can share the approach or give hints to solve the problem ,below I am attaching the problem statement. My time complexity of the solution was _O(N.x)_ where 'x' is the frequency of maximum element of the given array.↵
![ ](/predownloaded/fe/30/fe3044e911848888f0d99d5ff70b21ab8a1ea75b.jpg)↵
![ ](/predownloaded/67/78/6778fe88ec32366cf2abe15bf3e4196004a8bdb6.jpg)↵
![ ](/predownloaded/df/05/df054ac8186d501dde87312145878e888264208e.jpg)↵
Any help wouldill be appreciated.
![ ](/predownloaded/fe/30/fe3044e911848888f0d99d5ff70b21ab8a1ea75b.jpg)↵
![ ](/predownloaded/67/78/6778fe88ec32366cf2abe15bf3e4196004a8bdb6.jpg)↵
![ ](/predownloaded/df/05/df054ac8186d501dde87312145878e888264208e.jpg)↵
Any help w