title: Minimize The Sum Of Digits Of A And B Such That A B N
signature: minimize_the_sum_of_digits_of_a_and_b_such_that_a_b_n <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          2L, 
          2L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          39L, 
          12L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          31L, 
          4L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          45L, 
          9L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          35L, 
          8L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          94L, 
          13L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          67L, 
          13L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          50L, 
          5L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          4L, 
          4L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          63L, 
          9L
      )))
  
  }
  
  main()
source_py: def minimize_the_sum_of_digits_of_a_and_b_such_that_a_b_n(n):
      sum = 0
      while (n > 0):
          sum += (n % 10)
          n //= 10
      if (sum == 1):
          return 10
      return sum
source_cpp: int minimize_the_sum_of_digits_of_a_and_b_such_that_a_b_n(int n) {
    int sum = 0;
    while ( n > 0 ) {
      sum += ( n % 10 );
      n /= 10;
    }
    if ( sum == 1 ) return 10;
    return sum;
  }