when the person is single then why u r not considering to pick any of the person so
ans=nf(n-1)+nc2f(n-2)
Please see this
why would you multiply the f(n-1) with n?
The person in consideration is unique, you cannot choose him in n ways, because that’s how dp solution works. So its either f(n-1) or you can choose someone from the other n-1 people in n-1c1 ways and multiply with f(n-2).
i was relating this que to n steps problen when u can eihter take 1 or 2 steps at at time…but at that time steps are considered to be identical but person cannot be treated that way. so it should be choosing a person from n persons and if paring then 2 persons from n,that’s y.
f(n)=nf(n-1)+nc2f(n-2)
No in the construction of ours solution the nth person or step is unique and fixed, It is just similar to how we do basic permutation and combination.
I would suggest you to take a few examples and see for yourself if the answer is correct or incorrect.
(Also we aren’t arranging the persons ,only selecting)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.