All problems
Bell Number DP Value
Problem
The Bell number B(n) counts all set partitions of n labeled items and satisfies B(n) = sum_{k=0}^{n} S(n, k) for Stirling numbers of the second kind.
Given n, return B(n).
Hint
Build the Stirling triangle and sum the last row.
Test cases
case 1
in: [4]
expected: 15
case 2
in: [5]
expected: 52
case 3
in: [1]
expected: 1
Starter codePython
def bell_number_dp_value(n):
# Your code here
pass3 test cases · run your code against them in the editor