Datadog Interview Question

Implement a pattern matcher function.