I know , there is formula to apply, s!(r-s+1)( n-s P k-s).
I tried with example, n=5 ; r=3 and s=2. I'm getting answer as 2!*(3-2+1)*3 = 2*2*3 = 12.
But, if I solve manually with example, consider n = {1,2,3,4,5} then possible arrangements are as follows:
145 154 245 254 345 354 415 425 435 451 452 453 514 524 534 541 542 543. Total count is 18. Where am I going wrong
I am not able to view your link, but here is how I would calculate it:
You are looking for your arrangement to contain both 4 and 5. So, choose one more number (from the remaining 3). Then permute the three numbers. My guess (and this is a guess) is that the formula you are looking at has something to do with multisets.
Anyway, choosing the third number, then permuting the three numbers would give you this calculation:
$$\dbinom{3}{1}3! = 3\cdot 3\cdot 2\cdot 1 = 18$$
which agrees with the number of arrangements you found by writing every one out.