title: Find Index Of An Extra Element Present In One Sorted Array 1
signature: pub fn find_index_of_an_extra_element_present_in_one_sorted_array_1(arr1: Vec<i32>, arr2: Vec<i32>, n: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(arr1: Vec<i32>, arr2: Vec<i32>, n: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(arr1, arr2, n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        Vec::from([7, 18, 19, 25, 26, 27, 31, 39, 44, 46, 59, 60, 66, 72, 78, 83, 84, 92, 94]), Vec::from([2, 5, 12, 13, 17, 20, 22, 46, 51, 63, 64, 66, 66, 76, 87, 87, 90, 91, 96]), 11, 
        0
      ));
      
      println!("TEST-1...{}", driver(
        Vec::from([-14, -56, 92, -90, 96, -84, 64, -38, -20, 84, 56, 92, 18, -78, 98, -96, -60, 88, -52, -28, 30, -90, 14, 76, 56, 20, -18, -94, -82, -2, 96, -60, -64, -90, 42, 6, 20, -38, 82, -86, -4, 82, 54, -88]), Vec::from([54, 44, -50, 26, 4, -26, -76, 98, -14, 36, 82, 0, -60, 18, 52, 82, -12, -8, -26, -58, 22, -70, 24, 48, 56, -46, 92, 98, -50, -72, -66, 8, 40, 12, -80, -86, 90, -30, 76, -92, 80, -62, 0, -48]), 26, 
        0
      ));
      
      println!("TEST-2...{}", driver(
        Vec::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), Vec::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 31, 
        14
      ));
      
      println!("TEST-3...{}", driver(
        Vec::from([13, 64, 73, 50, 73, 19, 92, 10, 64, 79, 58, 41, 97, 53, 53, 10, 96, 45, 47, 38, 99]), Vec::from([24, 42, 54, 13, 88, 63, 50, 73, 64, 66, 86, 84, 53, 4, 44, 58, 44, 42, 36, 94, 34]), 13, 
        0
      ));
      
      println!("TEST-4...{}", driver(
        Vec::from([-96, -94, -90, -90, -78, -70, -64, -64, -58, -58, -52, -40, -36, -34, -34, -30, -26, -2, 0, 2, 14, 18, 24, 28, 28, 30, 34, 40, 42, 48, 66, 72, 86, 90, 92, 98]), Vec::from([-94, -92, -90, -88, -86, -82, -82, -80, -76, -74, -64, -60, -58, -46, -44, -36, -30, -30, -30, -18, -16, -8, -6, 12, 14, 20, 26, 38, 40, 42, 42, 68, 78, 82, 88, 98]), 29, 
        3
      ));
      
      println!("TEST-5...{}", driver(
        Vec::from([1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0]), Vec::from([0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0]), 19, 
        6
      ));
      
      println!("TEST-6...{}", driver(
        Vec::from([10, 51, 74, 74, 75, 80, 90]), Vec::from([12, 20, 36, 38, 61, 64, 93]), 5, 
        0
      ));
      
      println!("TEST-7...{}", driver(
        Vec::from([-44, 48, 20, -38, -48, -26, 56, -62, -94, -18, 30, 66, -16, 80, 96, -40, -80, 32, 88, -56, -76, 16, 72, -94, 4, -34, -92, 70, -90, -54, 64, -90]), Vec::from([-76, 92, -66, 20, 86, 40, 64, 16, 54, -6, 54, -88, -24, 38, 86, 2, 30, 70, 98, -46, 28, 34, 40, -88, -96, 92, 22, 14, -36, -96, -48, -72]), 28, 
        0
      ));
      
      println!("TEST-8...{}", driver(
        Vec::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), Vec::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 14, 
        9
      ));
      
      println!("TEST-9...{}", driver(
        Vec::from([19, 53, 13, 91, 52, 62, 39, 84, 68, 45, 32, 40, 13, 68, 79, 76, 11, 42, 76, 30, 81, 3, 30, 15, 85, 76, 1]), Vec::from([33, 65, 36, 82, 30, 95, 42, 33, 9, 21, 25, 90, 54, 59, 21, 45, 3, 93, 67, 50, 97, 72, 77, 54, 75, 8, 6]), 25, 
        0
      ));
      
  }
source_py: def find_index_of_an_extra_element_present_in_one_sorted_array_1(arr1, arr2, n):
      index = n
      left = 0
      right = (n - 1)
      while (left <= right):
          mid = int(((left + right) / 2))
          if (arr2[mid] == arr1[mid]):
              left = (mid + 1)
          else:
              index = mid
              right = (mid - 1)
      return index
source_cpp: int find_index_of_an_extra_element_present_in_one_sorted_array_1(vector<int> arr1, vector<int> arr2, int n) {
    int index = n;
    int left = 0, right = n - 1;
    while ( left <= right ) {
      int mid = ( left + right ) / 2;
      if ( arr2 [ mid ] == arr1 [ mid ] ) left = mid + 1;
      else {
        index = mid;
        right = mid - 1;
      }
    }
    return index;
  }