Hi, I was trying to solve this problem and I am having hard times getting an accepted solutions. I tried a standard 0/1 knapsack approach iterating on the quantities of each book but got TLE on 5/10 test cases. I made some research and found this blog on CF in which this solution was provided but I am not able to figure out neither why the loop over j stops at H[i] nor the inner loop over l. It seems a very complicated approach. Also I've found this other approach which seems way easier but even in this case I am not able to clarify in my mind what is going on. If anybody could explain me how this works will be very apprecciated. In particular if u could also provide me some useful easier/similar problem which uses similar concept would be amazing. my submission