Friends Pairing
1. You are given a number n, representing the number of friends.Input Format
2. Each friend can stay single or pair up with any of it's friends.
3. You are required to print the number of ways in which these friends can stay single or pair up.
E.g.
1 person can stay single or pair up in 1 way.
2 people can stay singles or pair up in 2 ways. 12 => 1-2, 12.
3 people (123) can stay singles or pair up in 4 ways. 123 => 1-2-3, 12-3, 13-2, 23-1.
A number nOutput Format
A number representing the number of ways in which n friends can stay single or pair up.Question Video
0 <= n <= 20Sample Input
4Sample Output
10
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run