Datadog interview question

Question was algorithms-esque, pretty much LC medium