Larger Number (did not get full marks)


plz provide me the testcase, where my code gave WA.
It shows TestCase0 and TeastCase1 as WA on submission.

Hi Adarsh,
ur code is failing over this input 1999999999
its output should be -1 as there is no smaller no possible by rearranging the digits…

Hi Vaibhav,
the o/p should be 9199999999 according to ur input.
b/c we have to find smallest greater number means just next greater number which has exact the digits(means permutation of digits).
so greater numbers of 1999999999 will be
9999999991, 9999999919,… so on
out of which 9199999999 is smallest greater number.

yes yes… correct… there issue with backend that’s why ur code failed… dont worry ur code is correct… its just some test cases need to be updated in backend…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.