Back to problems

Binary Search Log Entries by Date String

Algorithm · Pinterest · Medium

Requirements You are given a sorted collection of log entries, where each entry contains a date string in a format that can be compared lexicographically. Given a target date, return the index of the matching entry, or the position at which it should be inserted. Confirm the precise insertion and matching semantics with the interviewer. As a follow-up, process violation records represented as (user, timestamp) pairs. For a query interval [start, end], return the number of…

Checking your access…