I couldn’t understand what the following problem is trying to specify. Any inputs would be quite valuable.

# HackerEarth: Help Katekar

find a subset ( select some elements from array A) with maximum size (in short select maximum number of values from array A) such that the smallest value has smallest frequency and largest value selected has largest frequency and so on…

1 1 1 2 2 3 is not valid

1 2 2 3 3 3 is valid

1 3 3 5 5 5 5 is also valid

5 3 1 3 5 5 5 is also valid

1 2 3 3 is not valid as 1<2 but freq(1) is not < freq(2)

so if A* < A[j] then freq(A*) < freq(A[j])

Okay, thanks. That answer was helpful. I didn’t get the question at first now I realized my mistake.