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.

Example 1:

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

New contributor
Hashi Taka is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    $\begingroup$ I don't understand your question. What is $K$? What do you mean by "on the left"? Try to explain it again, using more words. $\endgroup$ Nov 26 at 14:49
  • $\begingroup$ Where did you encounter this task? Please credit the original source of all copied material: cs.stackexchange.com/help/referencing $\endgroup$
    – D.W.
    Nov 26 at 23:04
  • $\begingroup$ I see you previously asked this question before, deleted it, and posted a new slightly changed version of the question. In the future, please don't delete your question and re-post it -- instead, please edit it to make it clearer and address all feedback you've received. Thank you. $\endgroup$
    – D.W.
    Nov 26 at 23:05