Pergunta de entrevista da empresa Fiverr Inc.

String with 2 words, swap words locations without using extra data structure.

Resposta da entrevista

Sigiloso

25 de jul. de 2021

If 2 words are the same length, simple switching characters. else: If first(x characters) word is shorter than the second, swap x characters from the end of the string with the first word, Now the first word was moved to the end. now we have the second word in the beginning, but the right part of it in the beginning and the left part of it is in the begining. now recursively, you should do the same with the rest.

1