Pregunta de entrevista de Datadog

2 straightforward coding problems, strings and graphs