Pergunta de entrevista da empresa Barclays

Find next lexicographically greater permutation