title: Minimum Rotations Unlock Circular Lock
signature: class Solution {
  
      public Integer minimumRotationsUnlockCircularLock(Integer input, Integer unlock_code) {
source_py: def minimum_rotations_unlock_circular_lock(input, unlock_code):
      rotation = 0
      while ((input > 0) or (unlock_code > 0)):
          input_digit = (input % 10)
          code_digit = (unlock_code % 10)
          rotation += min(abs((input_digit - code_digit)), (10 - abs((input_digit - code_digit))))
          input = int((input / 10))
          unlock_code = int((unlock_code / 10))
      return rotation
source_cpp: int minimum_rotations_unlock_circular_lock(int input, int unlock_code) {
    int rotation = 0;
    int input_digit, code_digit;
    while ( input || unlock_code ) {
      input_digit = input % 10;
      code_digit = unlock_code % 10;
      rotation += min ( abs ( input_digit - code_digit ), 10 - abs ( input_digit - code_digit ) );
      input /= 10;
      unlock_code /= 10;
    }
    return rotation;
  }
question_info.extension: java
question_info.entry_fn_name: minimumRotationsUnlockCircularLock
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 8, "inputs": {"input": 71, "unlock_code": 46}}, {"idx": 1, "outputs": 8, "inputs": {"input": 90, "unlock_code": 65}}, {"idx": 2, "outputs": 8, "inputs": {"input": 28, "unlock_code": 84}}, {"idx": 3, "outputs": 4, "inputs": {"input": 41, "unlock_code": 23}}, {"idx": 4, "outputs": 6, "inputs": {"input": 32, "unlock_code": 58}}, {"idx": 5, "outputs": 8, "inputs": {"input": 39, "unlock_code": 82}}, {"idx": 6, "outputs": 7, "inputs": {"input": 33, "unlock_code": 58}}, {"idx": 7, "outputs": 8, "inputs": {"input": 89, "unlock_code": 32}}, {"idx": 8, "outputs": 1, "inputs": {"input": 50, "unlock_code": 51}}, {"idx": 9, "outputs": 7, "inputs": {"input": 92, "unlock_code": 77}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer input, Integer unlock_code, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(input, unlock_code,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(71, 46, 8);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(90, 65, 8);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(28, 84, 8);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(41, 23, 4);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(32, 58, 6);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(39, 82, 8);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(33, 58, 7);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(89, 32, 8);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(50, 51, 1);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(92, 77, 7);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer input, Integer unlock_code, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(input, unlock_code),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__