title: Find Index Of An Extra Element Present In One Sorted Array 1
signature: find_index_of_an_extra_element_present_in_one_sorted_array_1 <- function(arr1, arr2, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr1, arr2, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr1, arr2, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(7L, 18L, 19L, 25L, 26L, 27L, 31L, 39L, 44L, 46L, 59L, 60L, 66L, 72L, 78L, 83L, 84L, 92L, 94L), list(2L, 5L, 12L, 13L, 17L, 20L, 22L, 46L, 51L, 63L, 64L, 66L, 66L, 76L, 87L, 87L, 90L, 91L, 96L), 11L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-14L, -56L, 92L, -90L, 96L, -84L, 64L, -38L, -20L, 84L, 56L, 92L, 18L, -78L, 98L, -96L, -60L, 88L, -52L, -28L, 30L, -90L, 14L, 76L, 56L, 20L, -18L, -94L, -82L, -2L, 96L, -60L, -64L, -90L, 42L, 6L, 20L, -38L, 82L, -86L, -4L, 82L, 54L, -88L), list(54L, 44L, -50L, 26L, 4L, -26L, -76L, 98L, -14L, 36L, 82L, 0L, -60L, 18L, 52L, 82L, -12L, -8L, -26L, -58L, 22L, -70L, 24L, 48L, 56L, -46L, 92L, 98L, -50L, -72L, -66L, 8L, 40L, 12L, -80L, -86L, 90L, -30L, 76L, -92L, 80L, -62L, 0L, -48L), 26L, 
          0L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 31L, 
          14L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(13L, 64L, 73L, 50L, 73L, 19L, 92L, 10L, 64L, 79L, 58L, 41L, 97L, 53L, 53L, 10L, 96L, 45L, 47L, 38L, 99L), list(24L, 42L, 54L, 13L, 88L, 63L, 50L, 73L, 64L, 66L, 86L, 84L, 53L, 4L, 44L, 58L, 44L, 42L, 36L, 94L, 34L), 13L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-96L, -94L, -90L, -90L, -78L, -70L, -64L, -64L, -58L, -58L, -52L, -40L, -36L, -34L, -34L, -30L, -26L, -2L, 0L, 2L, 14L, 18L, 24L, 28L, 28L, 30L, 34L, 40L, 42L, 48L, 66L, 72L, 86L, 90L, 92L, 98L), list(-94L, -92L, -90L, -88L, -86L, -82L, -82L, -80L, -76L, -74L, -64L, -60L, -58L, -46L, -44L, -36L, -30L, -30L, -30L, -18L, -16L, -8L, -6L, 12L, 14L, 20L, 26L, 38L, 40L, 42L, 42L, 68L, 78L, 82L, 88L, 98L), 29L, 
          3L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L), list(0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L), 19L, 
          6L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(10L, 51L, 74L, 74L, 75L, 80L, 90L), list(12L, 20L, 36L, 38L, 61L, 64L, 93L), 5L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-44L, 48L, 20L, -38L, -48L, -26L, 56L, -62L, -94L, -18L, 30L, 66L, -16L, 80L, 96L, -40L, -80L, 32L, 88L, -56L, -76L, 16L, 72L, -94L, 4L, -34L, -92L, 70L, -90L, -54L, 64L, -90L), list(-76L, 92L, -66L, 20L, 86L, 40L, 64L, 16L, 54L, -6L, 54L, -88L, -24L, 38L, 86L, 2L, 30L, 70L, 98L, -46L, 28L, 34L, 40L, -88L, -96L, 92L, 22L, 14L, -36L, -96L, -48L, -72L), 28L, 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 14L, 
          9L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(19L, 53L, 13L, 91L, 52L, 62L, 39L, 84L, 68L, 45L, 32L, 40L, 13L, 68L, 79L, 76L, 11L, 42L, 76L, 30L, 81L, 3L, 30L, 15L, 85L, 76L, 1L), list(33L, 65L, 36L, 82L, 30L, 95L, 42L, 33L, 9L, 21L, 25L, 90L, 54L, 59L, 21L, 45L, 3L, 93L, 67L, 50L, 97L, 72L, 77L, 54L, 75L, 8L, 6L), 25L, 
          0L
      )))
  
  }
  
  main()
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;
  }