How many five-digit numbers can be made from the digits $0, 1, 2, 3, 4$, provided that each digit can be repeated twice? The 10,000th place can be filled in $4$ different ways, the 1000th place can be filled in $5$ different ways, the 100th place can be filled in $4$ different ways, seeing the double repetition of numerical values, and the 10th and 1st places must be filled $(5-2)=3$ different ways each. Thus, the total number of possible such 5-digit numbers is $4 \cdot 5 \cdot 4 \cdot 3 \cdot 3 = 720$.
However, i found the following solution:
$$1) 1\cdot5!/1=120$$
$$2) 5\cdot5!/2=300$$
$$3) 10\cdot5!/4=300$$
$1)$ understandable. The number of all possible choices with zero in any position.
$1) 2)$ already incomprehensible. In theory, you need to calculate how many numbers there will be so that there is no zero in front. After all, such numbers are invalid. And somehow calculate, the number of options with repeating numbers $2$ times. Could you explain this to me?
 A: $\color{red}{HINT=}$There are three situation such that zero is used once , zero is used two times  and zero is not used.
Zero is not used : Our generaitng function is $(1+ x+ \frac{x^2}{2})^4$ , then find the coefficient of $x^5$ and multiply it by $5!$
Zero is used once= Our generating function is $(1+ x+ \frac{x^2}{2})^4$ , then find the coefficient of $x^4$ and multiply it by $4!$. After that select one place for $0$ among $4$ suitable place.
Zero is used two times = Our generating function is $(1+ x+ \frac{x^2}{2})^4$ , then find the coefficient of $x^3$ and multiply it by $3!$. After that select two place for $0$ among $3$ suitable place.
$\color{blue}{OR}$,
More concisely, Lets think all of arrangement where zero may be leadind digit such that $(1+ x+ \frac{x^2}{2})^5$ , then find the coefficient of $x^5$ and multiply it by $5!$.
Now we should subtract the cases where zero is leading digit such that $(1+ x+ \frac{x^2}{2})^4 \times (1+x)$ , then find the coefficient of $x^4$ and multiply it by $4!$.
At last , subtract these two cases . Then you will find the number of $5$ digits numbers where it does not start with $0$ and each terms repeat at most $2$ times.
A: If leading zero is allowed, the count of numbers with given constraints is $2220$ as you mentioned in the comments. But if we only consider actual five digit numbers, you can either subtract all numbers with leading zero meeting other constraints from $2220$. Here is another way to go about it -
a) The most significant digit does not repeat -

*

*$4$ ways to choose the most significant digit

i) two digits repeat

*

*$\displaystyle {4\choose 2}$ ways to choose digits to repeat and $\dfrac{4!}{2! \ 2!}$ ways to permute them.

ii) one digit repeats

*

*$4$ ways to choose the digit to repeat and $3$ ways to choose $2$ remaining digits and permute them in  $\dfrac{4!}{2!}$.

iii) No repetition

*

*All digits must be chosen and they can be permuted in $4!$ ways.

b) The most significant digit repeats -

*

*again, $4$ ways to choose the most significant digit

i) two digits repeat

*

*we choose another digit to repeat in $4$ ways and another digit from remaining $3$ digits in $3$ ways and then permute them in $\dfrac{4!}{2!}$ ways.

ii) only one digit repeats

*

*we choose three digits from remaining $4$ digits in $4$ ways and permute them in $4!$ ways.

So total number of ways =
$ \displaystyle 4 \cdot \left[{4\choose 2} \frac{4!}{2! \; 2!} + 4 \cdot 3 \cdot \frac{4!}{2!} + 4! + 4 \cdot 3 \cdot \frac{4!}{2!} + 4 \cdot 4!\right] = 1776$
