I am new to this community and don't know well how to ask questions. Please give any comments if I made a mistake
The question is how many permutations of input numbers exist under certain. K is any given number from input. The condition is that there can be only one digit on the left which is bigger than K.
Input : 2 1 3 Output : 4
While the permutations of input are ['213', '231', '123', '132', '321', '312'], the numbers '231' and '321' doesn't fit the condition. Therefore, the answer is 4
Example 2: Input : 1 2 2 Output : 4
Answer is 4 because duplicated permutation is allowed