The Bell number B(n) is the number of ways to partition a set of n distinct elements into non-empty subsets. For example, B(3) = 5 because the set {1, 2, 3} can be partitioned in 5 ways: {{1},{2},{3}}, {{1,2},{3}}, {{1,3},{2}}, {{2,3},{1}}, and {{1,2,3}}.
Implement the function `bell_number(n: int) -> int` that returns B(n).
- The Bell number satisfies the recurrence: B(0) = 1 and B(n) = sum_{k=0}^{n-1} C(n-1, k) * B(k).
- You may use dynamic programming with the Bell triangle (also known as the Aitken's array) or any correct method.
- Input `n` is a non-negative integer.
- Return the exact integer B(n).
Constraints
0 ≤ n ≤ 20. The result fits within a Python int (B(20) = 51724158235372).
Expected time complexity: O(n^2) or better.