Is my impletation correct for this problem prateek bhaiya taught

also let me know the way he solved it or implemented it

the way bhaiya solved this problem is .

ways(n) -> ways n friend can go to party
ways(n) - > nth friend went alone + nth friend went in pair

ways(n)-> ways(n-1) + (n-1) * ways(n-2)

so this is the recurrence .

1 Like

this is the corrected code, right

yeah this should work