You have to try all cases:

Case 1: all distinct digits: 4!=24

Case 2: two same digits and two different digits:

that implies two more sub-cases:

(i) {3,3,-,-} these two blanks can only be filled by two out of the three {7,1,8} = C(3,2)=3 and then arrangement of these 4 numbers = (4!/2!); In total by pdt rule=3*12=36

(ii) {7,7,-,-} similarly here 2 out of the three {3,1,8}=3 and then arrangement=(4!/2!). total by pdt rule=3*12=36;

Case 3: two same and other two same:

{3,3,7,7}=(4!/(2!*2!))=6

by sum rule, total possibilities=6+2*36+24=102