Pergunta de entrevista da empresa Blueshift

the question was about string permutation