Barclays interview question

Find next lexicographically greater permutation