Pergunta de entrevista da empresa Uber

A classic permutation questions. Followed by the question if duplicates exist.