Hi,
something I don’t get on test 8 :
1984 is the only real new. I thought I had to remove Captive and put 1984 instead. But the solution is something else (Ninth House and Yellowface also removed)
Thx for answer
I think instructions are not really clear. Do we always have to delete one book before insertion even if there is free space ? Do we need to delete all books of same rank of the lowest one each time we delete one ? And what should cause “tbr out of control” : when we can’t delete book before insertion ? When we can’t delete lowest rank book as its rank is None even if there is free space ?
The shelf starts with full of books. If you want to add a new book to it, you must first remove an old book to make space (just like in real life).
The new books must be kept (if an old book of the same title is on the shelf, the book is always kept regardless of its ranking. In this case, the new book is kept instead of the old one).
The highest ranking books must be kept.
No duplicate is kept.
If there is no way to remove books so that all the above conditions are fulfilled, then it’s considered “TBR out of control”.
Yes.
If rank is None, that means the book hasn’t been read yet, so you can’t remove the book based on the statement.
She should keep her favorite book(s), the one that has/those that share the highest ranking
– It should be clarified that the highest rating is from the books that are currently on the shelf, because the highest rating is 10, but this does not mean that such a book will be on the shelf. At the same time, in reality, a book with the highest rating can be removed from the shelf if such a book is in the added (but I did not consider the case if there are duplicates of books with the highest rating, it turns out that if she wants to get rid of copies, then she can also get rid of copies of books with the highest rating, and this already creates a little contradiction).
She should keep her TBR books.
This can also mean that you cannot remove books from the shelf that have a TBR rating. But in reality, you can remove books with such a rating if such a book is in the added.
She doesn’t want to have duplicates on her bookshelf.
– This can be interpreted as meaning that she wants to get rid of duplicates first, not books with low ratings.
She removes her least favorite books first, i.e. smallest ranking as well as the duplicate(s) on her bookshelf before adding the new books (duplicates included)
– Duplicates of books with low ratings or duplicates in general?
When she removes a book from her bookshelf, all the books with the same ranking will be removed!
– But if you need to remove a book with a TBR rating, you can’t delete other books with the same rating.
As a result, it is not clear which books should be deleted first. For example, the following solution worked for me: first, duplicates of one book are deleted (and the book itself too) and books with the same rating as those being deleted, and the availability of free space is checked. If there is space, we return a sorted list of books. If there is not, we delete the books with the lowest rating and check for space again. If there is no space again, we delete duplicates of the books that we want to add, and so on in a circle until there is something to delete and space is not found (it is clear that my solution is not optimal).