Pergunta de entrevista da empresa Amazon

The second question was a string implementation problem,