Katkat

Solve library coding tasks in Python

MetaData Engineer · Technical Screen

Last 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:

  1. 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.
  2. 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.
  3. 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.