title: Double Factorial 1
signature: class Solution {
  
      public Long doubleFactorial1(Integer n) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Long expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(24, 1961990553600L);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(3, 3L);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(22, 81749606400L);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(2, 2L);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(30, 42849873690624000L);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(2, 2L);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Long expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Long actual, Long expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def double_factorial_1(n):
      res = 1
      for i in range(n, (- 1), (- 2)):
          if ((i == 0) or (i == 1)):
              return res
          else:
              res *= i
source_cpp: unsigned int double_factorial_1(unsigned int n) {
    int res = 1;
    for ( int i = n;
    i >= 0;
    i = i - 2 ) {
      if ( i == 0 || i == 1 ) return res;
      else res *= i;
    }
  }