Datadog interview question

Just solving a leetcode question