Back to problems

Implement a Function 'get_when' in an In-Memory Database

Object-Oriented Programming · Anthropic · Easy

Problem Build an in-memory database that accepts events in chronological sequence and can identify when a condition first becomes true. Provide a method for inserting an event and a get_when(predicate) method that finds the earliest timestamp belonging to an event for which predicate(event) returns True. Input format Each event contains a timestamp field, which is an integer, and a data field that may hold any type of additional information. predicate is a function that…

Checking your access…