Build challenge: build a library management system
Asked in the build challenge stage. Implement a stateful function that processes borrowing, returning, and title-search operations.
books is a list of {id, title, copies} dictionaries. operations contains borrow, return, and search dictionaries. Return one result per operation. Borrowing uses available copies first, then a FIFO waitlist. A member cannot borrow or waitlist for the same book more than once.
def manage_library(books, operations):