Find count of greater numbers

Given a number n, find and return the number of numbers that are greater than n using the same set of digits as n. Assume number n doesn't contain any duplicate digits.

e.g. if n is 123, you need to count the numbers which are formed using 1,2 and 3 which are greater than 123. Return 0 if no greater number is possible.

Sample Input :
123
Sample Output :
5

Login to submit your solution

Fb dab53a1a64929320dc7425896aa73fd9e5512b6ab52e414ff5f3ebb5cecc73eb

Share Problem