Well this was one of the most amazing and interesting ques…
But how to derive the formula based upon the the values of N and M…
And please some one provide link for Similar ques and study material for learning that!!
Thanx in advance…
@jaythegenius : Let M = N + j .
You can put the objects 1 to j first . Then from remaining objects ( j+1 to N ) put one from the last and then one from beginning and do so till there are more objects . Based on this placement logic and normal combinatorial arguments you will be able to get to the formula .
2 Likes
There is a wonderful solution written already here…
http://discuss.codechef.com/questions/13493/discussion-for-permute
1 Like
yeah thanx for that link!!
welcome… we are all here to help you.