title: Eulerian Number 1
signature: function eulerianNumber1(n: number, m: number): number {
source_py: def eulerian_number_1(n, m):
      dp = [[0 for x in range((m + 1))] for y in range((n + 1))]
      for i in range(1, (n + 1)):
          for j in range(0, (m + 1)):
              if (i > j):
                  if (j == 0):
                      dp[i][j] = 1
                  else:
                      dp[i][j] = (((i - j) * dp[(i - 1)][(j - 1)]) + ((j + 1) * dp[(i - 1)][j]))
      return dp[n][m]
source_cpp: int eulerian_number_1(int n, int m) {
    int dp [ n + 1 ] [ m + 1 ];
    memset ( dp, 0, sizeof ( dp ) );
    for ( int i = 1;
    i <= n;
    i ++ ) {
      for ( int j = 0;
      j <= m;
      j ++ ) {
        if ( i > j ) {
          if ( j == 0 ) dp [ i ] [ j ] = 1;
          else dp [ i ] [ j ] = ( ( i - j ) * dp [ i - 1 ] [ j - 1 ] ) + ( ( j + 1 ) * dp [ i - 1 ] [ j ] );
        }
      }
    }
    return dp [ n ] [ m ];
  }
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"n": 6, "m": 10}}, {"idx": 1, "outputs": 0, "inputs": {"n": 26, "m": 33}}, {"idx": 2, "outputs": 0, "inputs": {"n": 74, "m": 86}}, {"idx": 3, "outputs": 0, "inputs": {"n": 65, "m": 97}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, m: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n, m),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(6, 10, 0);
    console.log(`TEST-0...${result}`);
  
    result = driver(26, 33, 0);
    console.log(`TEST-1...${result}`);
  
    result = driver(74, 86, 0);
    console.log(`TEST-2...${result}`);
  
    result = driver(65, 97, 0);
    console.log(`TEST-3...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: eulerianNumber1
question_info.test_case_ids: 0 1 2 3
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js