title: Minimum Steps Minimize N Per Given Condition
signature: function minimum_steps_minimize_n_per_given_condition(n)
test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(59, 9)
      print(string.format("TEST-0...%s",result))
  
      result = driver(7, 3)
      print(string.format("TEST-1...%s",result))
  
      result = driver(90, 13)
      print(string.format("TEST-2...%s",result))
  
      result = driver(78, 11)
      print(string.format("TEST-3...%s",result))
  
      result = driver(49, 6)
      print(string.format("TEST-4...%s",result))
  
      result = driver(15, 6)
      print(string.format("TEST-5...%s",result))
  
      result = driver(45, 13)
      print(string.format("TEST-6...%s",result))
  
      result = driver(56, 6)
      print(string.format("TEST-7...%s",result))
  
      result = driver(7, 3)
      print(string.format("TEST-8...%s",result))
  
      result = driver(70, 12)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
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 ];
  }