Barclays Interview Question

Find next lexicographically greater permutation