title: Basic And Extended Euclidean Algorithms
signature: class Solution {
  
      public Integer basicAndExtendedEuclideanAlgorithms(Integer a, Integer b) {
source_py: def basic_and_extended_euclidean_algorithms(a, b):
      if (a == 0):
          return b
      return basic_and_extended_euclidean_algorithms((b % a), a)
source_cpp: int basic_and_extended_euclidean_algorithms(int a, int b) {
    if ( a == 0 ) return b;
    return basic_and_extended_euclidean_algorithms ( b % a, a );
  }
question_info.extension: java
question_info.entry_fn_name: basicAndExtendedEuclideanAlgorithms
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 1, "inputs": {"a": 46, "b": 89}}, {"idx": 1, "outputs": 2, "inputs": {"a": 26, "b": 82}}, {"idx": 2, "outputs": 4, "inputs": {"a": 40, "b": 12}}, {"idx": 3, "outputs": 2, "inputs": {"a": 58, "b": 4}}, {"idx": 4, "outputs": 1, "inputs": {"a": 25, "b": 44}}, {"idx": 5, "outputs": 1, "inputs": {"a": 2, "b": 87}}, {"idx": 6, "outputs": 1, "inputs": {"a": 8, "b": 65}}, {"idx": 7, "outputs": 3, "inputs": {"a": 21, "b": 87}}, {"idx": 8, "outputs": 2, "inputs": {"a": 82, "b": 10}}, {"idx": 9, "outputs": 1, "inputs": {"a": 17, "b": 61}}]
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 a, Integer b, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(a, b,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(46, 89, 1);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(26, 82, 2);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(40, 12, 4);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(58, 4, 2);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(25, 44, 1);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(2, 87, 1);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(8, 65, 1);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(21, 87, 3);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(82, 10, 2);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(17, 61, 1);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer a, Integer b, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(a, b),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__