Pergunta de entrevista da empresa Amazon

Find substring in string. give complexity for time