P18016 [GeeksforGeeks] Bell numbers2108
普及-
题目描述

Given a set of n elements, find number of ways of partitioning it.

Example 1:
Input:
N = 2
Output: 2
Explanation:
Let the set be
{1, 2}:
{ {1}, {2} } { {1, 2} }

Example 2:
Input:
N = 3
Output: 5
Your Task:
You don't need to read input or print anything. Your task is to complete the function bellNumber() which takes the integer N as input parameters and returns the number of ways of partitioning n elements. Since the value can be quite large print the value modulo 10^{9}+7.
Expected Time Complexity: O(N^2)
Expected Auxiliary Space: O(N^2)

Constraints:
1 ≤ N ≤ 1000

输入格式

见题面

输出格式

见题面

样例输入
N = 2
样例输出
2