Since you have 5 cards, there's 5! ways you can arrange them which is 1*2*3*4*5 = 120. But we're not going to list all 120 ways and eliminate those that don't match. The first criteria indicates that the last digit will be 1, 3, or 5. The second criteria indicates that the first digit will be 3, 4, or 5. The middle 3 digits don't matter. So all we need to do is enumerate what combination of 1st and last digits, then multiply by 6 (3!). So let's try them out
Starting with 3 has only 2 possibilities. 3xxx1 3xxx5
Starting with 4 has 3 possibilities 4xxx1 4xxx3 4xxx5
Starting with 5 has 2 possibilities. 5xxx1 5xxx3
So there is a total of 7 different combinations of first and last digits that will satisfy the criteria. And with the 3 left over cards for each combination you can arrange them in 3! ways or 6. So 7 times 6 is the number of different numbers you can make, which is 42. <span>Douglas Adams would be so proud.</span>