Adam is very fond of reading books. He has given rating to each book according to his likes and dislikes. He reads books one after other and he becomes happy everytime when he finishes a book and starts a higher rating book. Given the No. Of books and rating for each book, find maximum number of times he will become happy.
Input :
No. of books
rating for each book ( need not be distinct )
Output:
Maximum no. of times he can become happy.
I know we have to arrange the entries in a way so that he can be happy maximum number of times.Direct sorting won't help.Any approach to the question is appreciated.Thanks in advanced!!
Aucun commentaire:
Enregistrer un commentaire