sixpointer wrote:reddy43 wrote:for n things not to be in their right places
no. of ways = n!{1/2!-1/3!+....(-1)^n*1/n!} where n>=2
so we will have this one as 265 ways
can u explain me how does this formula work ? what is the logic behind this? where to use

This is a Q of Derangement
I can explain how it works but do not ever dare to get into the logic as the concept behind the formula will drive you crazy...
Derangement means the item should not appear at the place where it originally was.
Say ABC now we can arrange this in 3!=6 ways
1.ABC
2.ACB
3.BAC
4.BCA
5.CAB
6.CBA
But the derangement will be 2 only BCA and CAB. see none of A B or C are being placed at their original places. A cant be at 1st, B cant be at 2nd and C cant be at 3rd place.
So just remember the formula no. of ways = n!{1/2!-1/3!+....(-1)^n*1/n!} where n>=2 .
My example n=3 Thus, 3!{1/2! - 1/3!} = 2.
Need more info
https://en.wikipedia.org/wiki/Derangement
but it will have Limit (Math). So be careful

If the problem is Easy Respect it, if the problem is tough Attack it