title: Minimize The Sum Of Digits Of A And B Such That A B N
signature: fun minimizeTheSumOfDigitsOfAAndBSuchThatABN(n: Int): Int {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": 2, "inputs": {"n": 2}}, {"idx": 1, "outputs": 12, "inputs": {"n": 39}}, {"idx": 2, "outputs": 4, "inputs": {"n": 31}}, {"idx": 3, "outputs": 9, "inputs": {"n": 45}}, {"idx": 4, "outputs": 8, "inputs": {"n": 35}}, {"idx": 5, "outputs": 13, "inputs": {"n": 94}}, {"idx": 6, "outputs": 13, "inputs": {"n": 67}}, {"idx": 7, "outputs": 5, "inputs": {"n": 50}}, {"idx": 8, "outputs": 4, "inputs": {"n": 4}}, {"idx": 9, "outputs": 9, "inputs": {"n": 63}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(2, 2)
      println("TEST-0...${result}")
      
      result = driver(39, 12)
      println("TEST-1...${result}")
      
      result = driver(31, 4)
      println("TEST-2...${result}")
      
      result = driver(45, 9)
      println("TEST-3...${result}")
      
      result = driver(35, 8)
      println("TEST-4...${result}")
      
      result = driver(94, 13)
      println("TEST-5...${result}")
      
      result = driver(67, 13)
      println("TEST-6...${result}")
      
      result = driver(50, 5)
      println("TEST-7...${result}")
      
      result = driver(4, 4)
      println("TEST-8...${result}")
      
      result = driver(63, 9)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: minimizeTheSumOfDigitsOfAAndBSuchThatABN
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn