Bro code is not oprimized Tc should be n*k But your code has tc - n*k*logk
Does your solution considered the case if the frequency is same
this code gives tle
@SanjayKumar-iu7rq