leetle

Daily challenge for 2026-09-17

625. Library Book Return Pairs

You are given a list of strings records, where each string represents a book checkout or return in the format "ID STATUS". ID is the book's unique identifier and STATUS is either "OUT" or "IN". A book is considered successfully returned if there is an "OUT" record followed by an "IN" record for the same book ID. Return the total number of successfully returned books. Assume each book is checked out at most once and returned at most once.

Example:
Input: records = ["101 OUT", "102 OUT", "101 IN", "103 OUT"]
Output: 1

Run this challenge interactively in Python or JavaScript when the app loads.