What is the next largest permutation in lexicographic order after 362451 ?
I am clueless to even understand question.
Please help.
My guess is that you are asked to find a permutation p of 362451 with this property: p > 362451 in lexicographic order, but there is no other permutation p' such that p > p' > 362451.
Note that lexicographic order on numbers with the same number of digits coincides with the regular numerical order.