Ways to Partition a Set
Count the ways to partition a set of N labelled elements into any number of non-empty unlabelled groups — the Bell number B(N) — modulo 109+7.
Input: one integer N.
Output: B(N) mod 109+7.
Constraints:
- 0 ≤ N ≤ 3000
Sample Tests
Input 1
3
Output 1
5
Input 2
0
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.