Datadog interview question

Asked to code on a whiteboard.