title: Dyck Path
signature: function dyck_path(n)
source_py: def dyck_path(n):
      res = 1
      for i in range(0, n):
          res *= ((2 * n) - i)
          res /= (i + 1)
      return (res / (n + 1))
source_cpp: int dyck_path(unsigned int n) {
    int res = 1;
    for ( int i = 0;
    i < n;
    ++ i ) {
      res *= ( 2 * n - i );
      res /= ( i + 1 );
    }
    return res / ( n + 1 );
  }
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return math.abs(actual - expected) < 1e-09
  end
  
  function driver(n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(28, 263747951750360.03)
      print(string.format("TEST-0...%s",result))
  
      result = driver(13, 742900.0)
      print(string.format("TEST-1...%s",result))
  
      result = driver(7, 429.0)
      print(string.format("TEST-2...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 263747951750360.03, "inputs": {"n": 28}}, {"idx": 1, "outputs": 742900.0, "inputs": {"n": 13}}, {"idx": 2, "outputs": 429.0, "inputs": {"n": 7}}]
question_info.extension: lua
question_info.entry_fn_name: dyck_path
question_info.test_case_ids: 0 1 2
question_info.commands: lua __FILENAME__