title: Count Digits Factorial Set 1
signature: countDigitsFactorialSet1(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          66, 
          93)
      }");
  
      print("TEST-1...${driver(
          7, 
          4)
      }");
  
      print("TEST-2...${driver(
          55, 
          74)
      }");
  
      print("TEST-3...${driver(
          37, 
          44)
      }");
  
      print("TEST-4...${driver(
          76, 
          112)
      }");
  
      print("TEST-5...${driver(
          16, 
          14)
      }");
  
      print("TEST-6...${driver(
          17, 
          15)
      }");
  
      print("TEST-7...${driver(
          95, 
          149)
      }");
  
      print("TEST-8...${driver(
          71, 
          102)
      }");
  
      print("TEST-9...${driver(
          90, 
          139)
      }");
  
      return 0;
  }
source_py: def count_digits_factorial_set_1(n):
      if (n < 0):
          return 0
      if (n <= 1):
          return 1
      digits = 0
      for i in range(2, (n + 1)):
          digits += math.log10(i)
      return (math.floor(digits) + 1)
source_cpp: int count_digits_factorial_set_1(int n) {
    if ( n < 0 ) return 0;
    if ( n <= 1 ) return 1;
    double digits = 0;
    for ( int i = 2;
    i <= n;
    i ++ ) digits += log10 ( i );
    return floor ( digits ) + 1;
  }