The purpose of this question


I thought a lot about how to employ binary search but eventually I took the simpler route, i.e: first sort the array in descending order and then simply perform a linear search to spot the height. The time complexity is O(nlogn) and space complexity is O(n)
Can someone tell precisely tell what was the purpose this question as I have a intuition that we can optimise on this approach.