Problem 556 · Medium

Next Greater Element III

Find the smallest integer greater than the given integer that is a permutation of its digits.

Open the interactive visualisation