Question: You are tasked with writing a function that takes in a vector of integers and returns a new vector, sorted based on the frequency of
You are tasked with writing a function that takes in a vector of integers and returns a new vector, sorted based on the frequency of the integers in descending order. If two numbers have the same frequency, the larger number appears first. Let's illustrate what we mean by example. In the following examples, we use the notation to show the composition of a vector. In resides at index at index and so on
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
