Algorithm · Reddit · Medium
A chat application stores a history of messages, each with a unique, strictly increasing integer id and a string content. All messages are kept in ascending order by id. You may assume the following read‑only data model for a message: The chat system exposes an API to fetch a batch of messages centered on a particular ID. The provided Chat class is: Implement the ChatMessageMerger class: ChatMessageMerger(Chat chat, int windowSize) Initializes the merger with the supplied…
Checking your access…