title: Eulerian Number 1
signature: fun eulerianNumber1(n: Int, m: Int): Int {
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.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, m: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n, m), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(6, 10, 0)
      println("TEST-0...${result}")
      
      result = driver(26, 33, 0)
      println("TEST-1...${result}")
      
      result = driver(74, 86, 0)
      println("TEST-2...${result}")
      
      result = driver(65, 97, 0)
      println("TEST-3...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: eulerianNumber1
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn