Pergunta de entrevista da empresa Uber

Longest repeating sequence with replacement