Pergunta de entrevista da empresa Yandex

1) Given as string, replace all spaces with «%20» using minimum additional memory 2) Given a text T and a string S, find a substring S' in the T such that S and S' are equal up to permutation.