0

Can someone figure this question out for me please ??

You are allowed to attempt the questions with any backend technologies of your choice. Given a list of integers, create a function that returns the nth-rarest item. The function should be called nth_most_rate signature and its signature nth_most_rate signature(list,n) where list is the array of integers and n is the nth rarest term. For example in ([5,4,5,4,5,4,4,5,3,3,3,2,2,1,5], if 2 is supplied as n, the answer is 2 as 2 is the 2nd rarest item. https://www.sololearn.com/discuss/3097566/?ref=app https://code.sololearn.com/WzQLplcD7mw6/?ref=app https://www.sololearn.com/discuss/3097607/?ref=app

27th Oct 2022, 11:12 AM
CHINONSO IZUNOBI
CHINONSO IZUNOBI - avatar
3 Answers
+ 9
CHINONSO IZUNOBI , if you need support, please include a link to your attempt in your question.
27th Oct 2022, 11:52 AM
Lothar
Lothar - avatar
+ 5
Look, you have the same homework: https://www.sololearn.com/Discuss/3097876/?ref=app
27th Oct 2022, 2:27 PM
Lisa
Lisa - avatar
+ 4
FOR PYTHON Make a list of distinct values in your list : list(set(list)) Sort this new list. The key for sorting is a function, that counts each item in your original list. Another opportunity would be a dictionary with key = distinct numbers and value = number of appearance in your list Also depth dict is to be sorted. Another way would be : A dict that assigns to each key the number of values with key occurrences. In this case a simple sort by key (or per default) will do it. There are some more elaborated versions.
27th Oct 2022, 1:10 PM
Oma Falk
Oma Falk - avatar