title: Find Index Of An Extra Element Present In One Sorted Array 1
signature: class Solution {
  
      public int FindIndexOfAnExtraElementPresentInOneSortedArray1(List<int> arr1, List<int> arr2, int n) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(int actual, int expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(List<int> arr1, List<int> arr2, int n, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(arr1, arr2, n); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  new List<int>{7, 18, 19, 25, 26, 27, 31, 39, 44, 46, 59, 60, 66, 72, 78, 83, 84, 92, 94}, new List<int>{2, 5, 12, 13, 17, 20, 22, 46, 51, 63, 64, 66, 66, 76, 87, 87, 90, 91, 96}, 11, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-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}, new List<int>{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
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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}, new List<int>{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
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{13, 64, 73, 50, 73, 19, 92, 10, 64, 79, 58, 41, 97, 53, 53, 10, 96, 45, 47, 38, 99}, new List<int>{24, 42, 54, 13, 88, 63, 50, 73, 64, 66, 86, 84, 53, 4, 44, 58, 44, 42, 36, 94, 34}, 13, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-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}, new List<int>{-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
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0}, new List<int>{0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0}, 19, 
                  6
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{10, 51, 74, 74, 75, 80, 90}, new List<int>{12, 20, 36, 38, 61, 64, 93}, 5, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-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}, new List<int>{-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
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, new List<int>{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
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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}, new List<int>{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
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
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;
  }