Pregunta de entrevista de Splunk

Typical leetcode medium and one hard question