title: Tail Recursion
signature: function tail_recursion(n)
source_py: def tail_recursion(n):
      if (n == 0):
          return 1
      return (n * tail_recursion((n - 1)))
source_cpp: unsigned int tail_recursion(unsigned int n) {
    if ( n == 0 ) return 1;
    return n * tail_recursion ( n - 1 );
  }
question_info.entry_fn_name: tail_recursion
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0']
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 isCorrect(actual,expected)
  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(16, 20922789888000)
      print(string.format("TEST-0...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 20922789888000, "inputs": {"n": 16}}]