Datadog interview question

Solve a leetcode style coding test