title: Program For Factorial Of A Number 2
signature: function programForFactorialOfANumber2(n: number): number {
source_py: def program_for_factorial_of_a_number_2(n):
      return (1 if ((n == 1) or (n == 0)) else (n * program_for_factorial_of_a_number_2((n - 1))))
source_cpp: int program_for_factorial_of_a_number_2(int n) {
    return ( n == 1 || n == 0 ) ? 1 : n * program_for_factorial_of_a_number_2 ( n - 1 );
  }
question_info.test_list: [{"idx": 0, "outputs": 2, "inputs": {"n": 2}}, {"idx": 1, "outputs": 479001600, "inputs": {"n": 12}}, {"idx": 2, "outputs": 39916800, "inputs": {"n": 11}}]
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, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(2, 2);
    console.log(`TEST-0...${result}`);
  
    result = driver(12, 479001600);
    console.log(`TEST-1...${result}`);
  
    result = driver(11, 39916800);
    console.log(`TEST-2...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: programForFactorialOfANumber2
question_info.test_case_ids: 0 1 2
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js