title: Bell Numbers Number Of Ways To Partition A Set
signature: class Solution {
  
      public Integer bellNumbersNumberOfWaysToPartitionASet(Integer n) {
source_py: def bell_numbers_number_of_ways_to_partition_a_set(n):
      bell = [[0 for i in range((n + 1))] for j in range((n + 1))]
      bell[0][0] = 1
      for i in range(1, (n + 1)):
          bell[i][0] = bell[(i - 1)][(i - 1)]
          for j in range(1, (i + 1)):
              bell[i][j] = (bell[(i - 1)][(j - 1)] + bell[i][(j - 1)])
      return bell[n][0]
source_cpp: int bell_numbers_number_of_ways_to_partition_a_set(int n) {
    int bell [ n + 1 ] [ n + 1 ];
    bell [ 0 ] [ 0 ] = 1;
    for ( int i = 1;
    i <= n;
    i ++ ) {
      bell [ i ] [ 0 ] = bell [ i - 1 ] [ i - 1 ];
      for ( int j = 1;
      j <= i;
      j ++ ) bell [ i ] [ j ] = bell [ i - 1 ] [ j - 1 ] + bell [ i ] [ j - 1 ];
    }
    return bell [ n ] [ 0 ];
  }
question_info.extension: java
question_info.entry_fn_name: bellNumbersNumberOfWaysToPartitionASet
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 21147, "inputs": {"n": 9}}, {"idx": 1, "outputs": 15, "inputs": {"n": 4}}, {"idx": 2, "outputs": 203, "inputs": {"n": 6}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(9, 21147);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(4, 15);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(6, 203);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2
question_info.commands: java __FILENAME__