title: Bell Numbers Number Of Ways To Partition A Set
signature: function bell_numbers_number_of_ways_to_partition_a_set(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(9, 21147);
      @printf("TEST-0...%s\n",result);
      
      result = driver(4, 15);
      @printf("TEST-1...%s\n",result);
      
      result = driver(6, 203);
      @printf("TEST-2...%s\n",result);
      
  end
  
  main()
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 ];
  }