Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use dynamic programming: dp(i) will be the answer to the problem for books[i:].
Solve with full IDE support and test cases