You are given an integer N representing N friends. Each friend can either stay single or pair up with one other friend. Your task is to find the total number of different ways the friends can remain single or be paired.
Each friend can be paired only once. Calculate and return the total number of possible arrangements.
Example 1
Input: N = 2
Output: 2
Explanation: The arrangements are: both single, or both paired together.
Example 2
Input: N = 3
Output: 4
Explanation: The arrangements are: all single, (1,2) pair, (1,3) pair, or (2,3) pair.
Example 3
Input: N = 4
Output: 10
Explanation: The arrangements include all single, one pair with two singles, or two separate pairs, giving a total of 10 different combinations.
Sign in to write, run, and submit your solution against the full test suite.