Company: Salesforce Amts_3april
Difficulty: medium
In Salesforce's Case Management System, cases are often tagged with priority values to help teams manage them effectively. The operations team wants to sort these cases for analysis. Each case has a priority value, and there can be multiple cases with the same value. The cases need to be sorted in ascending order, first by the frequency of each priority value and then by the priority values themselves. Return the sorted list of priority values. Example n = 6 priorities = [6, 5, 9, 5, 6, 7] There are 2 priorities that occur once: [7, 9]. There are 2 priorities that occur twice: [5, 5, 6, 6]. The array of items sorted by frequency and then by value in ascending order is [7, 9, 5, 5, 6, 6]. Function Description Complete the function getSortedCases in the editor below. getSortedCases has the following parameter(s): int priorities[n]: A list of integers representing case priority values. Returns int[n]: The sorted list of priority values based on frequency and value Constraints 1 ≤ n &le