You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sort(books.begin(),books.end()); //Groups books by same author together. Within the same groups, books are sorted from smallest happiness to largest happiness.
for(const auto& book : books) {
if(book.first==prev) {
rem+=book.second;
} else {
smallest.push_back(book.second);
prev=book.first;
}
}
//pick smallest book from each author
sort(smallest.begin(),smallest.end()); //sort these books from smallest to largest.