You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# You are given an array of integers. Sort them by frequency. See examples for more clarifications.
# Input Format
# The first line of input contains T - the number of test cases. It's followed by 2T lines, the first line contains N - the size of the array. The second line contains the elements of the array.
# Output Format
# For each test case, print the elements of the array sorted by frequency. In case 2 elements have the same frequency, print the smaller element first.