Construct Smallest Number From DI String
Push digits in order and pop a run of them only when the pattern says increase, which gives the smallest permutation that fits.
Push digits in order and pop a run of them only when the pattern says increase, which gives the smallest permutation that fits.