Editorial for LCC '23 Contest 1 J2 - Costume Scores


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Author: ninja888

For both subtasks, iterate through the array of N integers, adding one to Shane's placement for every score greater than Shane's score, while keeping track of the minimum and maximum values.

Time Complexity: O(N)

Alternatively, sort the array of N integers and binary search for Shane's placement, with index 0 and index N-1 being the maximum and minimum values.

Time Complexity: O(Nlog(N))


Comments

There are no comments at the moment.