OpenAI backend engineer interviews typically focus on APIs, databases, system design, concurrency, caching, and data structures.
MessageQueue that manages message sending and receiving among services.MessageQueue:send_message(service: str, message: str) -> None: Queues a message for the given service.receive_message(service: str) -> Optional[str]: Retrieves the next message for the specified service, if available.mq = MessageQueue() followed by mq.send_message("service1", "Hello World!") and mq.receive_message("service1")"Hello World!"mq.send_message("service2", "Goodbye!") and then mq.receive_message("service1")Noneservice1, it returns None.JobScheduler that manages scheduling and execution of jobs. Your implementation should handle job queuing and executing based on a predefined delay.JobScheduler:add_job(name: str, delay: int) -> None: Adds a job with a name and a delay before execution.execute_jobs(current_time: int) -> List[str]: Returns a list of job names that are executed at a given current time.scheduler = JobScheduler() followed by scheduler.add_job("Task1", 5) and scheduler.execute_jobs(5)['Task1']scheduler.add_job("Task2", 2) and then scheduler.execute_jobs(3)['Task2']Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free