title: Minimum Steps Minimize N Per Given Condition
signature: fun minimumStepsMinimizeNPerGivenCondition(n: Int): Int {
source_py: def minimum_steps_minimize_n_per_given_condition(n):
      table = ([0] * (n + 1))
      for i in range((n + 1)):
          table[i] = (n - i)
      for i in range(n, 0, (- 1)):
          if (not (i % 2)):
              table[(i // 2)] = min((table[i] + 1), table[(i // 2)])
          if (not (i % 3)):
              table[(i // 3)] = min((table[i] + 1), table[(i // 3)])
      return table[1]
source_cpp: int minimum_steps_minimize_n_per_given_condition(int n) {
    int table [ n + 1 ];
    for ( int i = 0;
    i <= n;
    i ++ ) table [ i ] = n - i;
    for ( int i = n;
    i >= 1;
    i -- ) {
      if ( ! ( i % 2 ) ) table [ i / 2 ] = min ( table [ i ] + 1, table [ i / 2 ] );
      if ( ! ( i % 3 ) ) table [ i / 3 ] = min ( table [ i ] + 1, table [ i / 3 ] );
    }
    return table [ 1 ];
  }
question_info.test_list: [{"idx": 0, "outputs": 9, "inputs": {"n": 59}}, {"idx": 1, "outputs": 3, "inputs": {"n": 7}}, {"idx": 2, "outputs": 13, "inputs": {"n": 90}}, {"idx": 3, "outputs": 11, "inputs": {"n": 78}}, {"idx": 4, "outputs": 6, "inputs": {"n": 49}}, {"idx": 5, "outputs": 6, "inputs": {"n": 15}}, {"idx": 6, "outputs": 13, "inputs": {"n": 45}}, {"idx": 7, "outputs": 6, "inputs": {"n": 56}}, {"idx": 8, "outputs": 3, "inputs": {"n": 7}}, {"idx": 9, "outputs": 12, "inputs": {"n": 70}}]
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(59, 9)
      println("TEST-0...${result}")
      
      result = driver(7, 3)
      println("TEST-1...${result}")
      
      result = driver(90, 13)
      println("TEST-2...${result}")
      
      result = driver(78, 11)
      println("TEST-3...${result}")
      
      result = driver(49, 6)
      println("TEST-4...${result}")
      
      result = driver(15, 6)
      println("TEST-5...${result}")
      
      result = driver(45, 13)
      println("TEST-6...${result}")
      
      result = driver(56, 6)
      println("TEST-7...${result}")
      
      result = driver(7, 3)
      println("TEST-8...${result}")
      
      result = driver(70, 12)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: minimumStepsMinimizeNPerGivenCondition
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