Solve library coding tasks in Python
MetaData Engineer · Technical ScreenLast updated
Solve library coding tasks in Python evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Implement the following Python tasks:
- Given a list of (category, points) for books, choose up to 3 books with all different categories to maximize total points; return the maximum achievable points.
- Given a dictionary mapping library_location -> list_of_people and a collection of closed locations, return a new dictionary containing only open locations and their associated people.
- Given an ordered list of log entries (book_id, action) where action is 'checkout' or 'return', validate the sequence: return False if a book is checked out twice in a row without a return, or returned when it is not currently checked out; otherwise return True.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.