PROBLEM LINK:
DIFFICULTY:
CAKEWALK
PREREQUISITES:
None
PROBLEM:
Given an unsorted array of unique elements, find the position of a specified elements in array’s sorted form.
QUICK EXPLANATION:
Count the number of elements in an unsorted array which are smaller than the given element.
EXPLANATION:
Since the length of all songs is unique, if we count the number of songs which have length less than the length of “Uncle Johny”, we know its position in sorted array.
Constraint on the value of N in this problem is very low so many contestants sorted the array and then did binary search for the length of “Uncle Johny” song in the sorted array. This approach also passes well within time limit.
AUTHOR'S AND TESTER'S SOLUTIONS:
Author's solution will be uploaded soon
Tester's solution can be found here and here