to make sure all digits are distinct, you must remember which digits you've already placed. A digit can only appear once. How do you track "used digits"? A bitmask.
If bit is set, digit has been used. Ten digits means a 10-bit mask. When placing digit , check if bit is already set. If yes, skip. If no, set bit and continue. Take time to understand the problem structure. The recursive relationship often becomes clear once you see how smaller instances relate to larger ones.