title: Find Index Of An Extra Element Present In One Sorted Array
signature: function findIndexOfAnExtraElementPresentInOneSortedArray(arr1: Array<number>, arr2: Array<number>, n: number): number {
source_py: def find_index_of_an_extra_element_present_in_one_sorted_array(arr1, arr2, n):
      for i in range(0, n):
          if (arr1[i] != arr2[i]):
              return i
      return n
source_cpp: int find_index_of_an_extra_element_present_in_one_sorted_array(vector<int> arr1, vector<int> arr2, int n) {
    for ( int i = 0;
    i < n;
    i ++ ) if ( arr1 [ i ] != arr2 [ i ] ) return i;
    return n;
  }
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"arr1": [1, 6, 7, 10, 11, 12, 12, 16, 17, 29, 32, 33, 35, 35, 45, 49, 52, 56, 57, 58, 61, 62, 63, 64, 68, 71, 71, 77, 79, 79, 81, 82, 82, 83, 83, 89, 89, 93, 94, 94], "arr2": [3, 12, 13, 14, 15, 17, 18, 19, 22, 24, 28, 29, 33, 37, 41, 42, 44, 49, 51, 51, 52, 53, 56, 56, 59, 60, 64, 64, 67, 70, 71, 78, 83, 88, 88, 90, 92, 93, 93, 95], "n": 36}}, {"idx": 1, "outputs": 0, "inputs": {"arr1": [-48, -92, 96, -18, 10, -24, -4, 96, -16, -78, 4, -80, -96, -28, -78, 68, 2, -60, 0], "arr2": [-38, -40, -50, 50, -26, -80, 64, 54, 74, -44, -40, -92, -16, 4, -60, -42, -60, -74, 38], "n": 16}}, {"idx": 2, "outputs": 0, "inputs": {"arr1": [1], "arr2": [0], "n": 0}}, {"idx": 3, "outputs": 0, "inputs": {"arr1": [68, 98, 21, 29, 71, 49], "arr2": [97, 90, 25, 89, 57, 41], "n": 3}}, {"idx": 4, "outputs": 0, "inputs": {"arr1": [-80, -76, -76, -76, -68, -66, -56, -44, -38, -28, -24, -10, 8, 14, 16, 18, 24, 26, 30, 32, 50, 64, 76, 80, 90, 94, 94, 94], "arr2": [-90, -88, -66, -60, -48, -48, -46, -42, -40, -36, -26, -4, 2, 4, 4, 8, 16, 18, 34, 50, 52, 56, 64, 80, 86, 90, 92, 96], "n": 14}}, {"idx": 5, "outputs": 2, "inputs": {"arr1": [0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1], "arr2": [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1], "n": 22}}, {"idx": 6, "outputs": 0, "inputs": {"arr1": [3, 7, 16, 17, 20, 22, 29, 32, 34, 34, 35, 40, 40, 40, 41, 46, 49, 58, 60, 62, 63, 64, 64, 68, 70, 73, 76, 79, 83, 86, 90, 92, 99], "arr2": [4, 4, 7, 13, 23, 23, 25, 25, 26, 34, 38, 39, 39, 45, 48, 50, 52, 54, 58, 59, 60, 65, 72, 76, 80, 80, 80, 84, 87, 90, 92, 94, 96], "n": 26}}, {"idx": 7, "outputs": 0, "inputs": {"arr1": [18, -68, -6, -32, -76, -86, -8, 76, -46, 20, -80, 54, -88, -58, -48, -66, -66, 18, -28, -74, -72, -26, -92, -78, 24, -22, -80, -80, 82, -2, -72, -88, -54, -84, -8], "arr2": [-30, 96, 92, -12, -14, -68, -16, 20, 74, -42, 36, 84, -82, 66, 44, 70, -92, -56, -28, -68, -4, 10, -4, 90, 72, 84, 68, 14, 32, 60, 40, 60, -34, 58, -56], "n": 17}}, {"idx": 8, "outputs": 24, "inputs": {"arr1": [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, 1], "arr2": [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, 1], "n": 24}}, {"idx": 9, "outputs": 0, "inputs": {"arr1": [74, 75, 52, 58, 34, 53, 51, 45, 34, 28, 53, 94, 10, 20, 23, 12, 95, 78, 48, 11], "arr2": [62, 56, 17, 1, 11, 30, 59, 18, 99, 21, 86, 49, 24, 85, 25, 56, 21, 66, 23, 96], "n": 17}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(arr1: Array<number>, arr2: Array<number>, n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(arr1, arr2, n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver([1, 6, 7, 10, 11, 12, 12, 16, 17, 29, 32, 33, 35, 35, 45, 49, 52, 56, 57, 58, 61, 62, 63, 64, 68, 71, 71, 77, 79, 79, 81, 82, 82, 83, 83, 89, 89, 93, 94, 94], [3, 12, 13, 14, 15, 17, 18, 19, 22, 24, 28, 29, 33, 37, 41, 42, 44, 49, 51, 51, 52, 53, 56, 56, 59, 60, 64, 64, 67, 70, 71, 78, 83, 88, 88, 90, 92, 93, 93, 95], 36, 0);
    console.log(`TEST-0...${result}`);
  
    result = driver([-48, -92, 96, -18, 10, -24, -4, 96, -16, -78, 4, -80, -96, -28, -78, 68, 2, -60, 0], [-38, -40, -50, 50, -26, -80, 64, 54, 74, -44, -40, -92, -16, 4, -60, -42, -60, -74, 38], 16, 0);
    console.log(`TEST-1...${result}`);
  
    result = driver([1], [0], 0, 0);
    console.log(`TEST-2...${result}`);
  
    result = driver([68, 98, 21, 29, 71, 49], [97, 90, 25, 89, 57, 41], 3, 0);
    console.log(`TEST-3...${result}`);
  
    result = driver([-80, -76, -76, -76, -68, -66, -56, -44, -38, -28, -24, -10, 8, 14, 16, 18, 24, 26, 30, 32, 50, 64, 76, 80, 90, 94, 94, 94], [-90, -88, -66, -60, -48, -48, -46, -42, -40, -36, -26, -4, 2, 4, 4, 8, 16, 18, 34, 50, 52, 56, 64, 80, 86, 90, 92, 96], 14, 0);
    console.log(`TEST-4...${result}`);
  
    result = driver([0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1], 22, 2);
    console.log(`TEST-5...${result}`);
  
    result = driver([3, 7, 16, 17, 20, 22, 29, 32, 34, 34, 35, 40, 40, 40, 41, 46, 49, 58, 60, 62, 63, 64, 64, 68, 70, 73, 76, 79, 83, 86, 90, 92, 99], [4, 4, 7, 13, 23, 23, 25, 25, 26, 34, 38, 39, 39, 45, 48, 50, 52, 54, 58, 59, 60, 65, 72, 76, 80, 80, 80, 84, 87, 90, 92, 94, 96], 26, 0);
    console.log(`TEST-6...${result}`);
  
    result = driver([18, -68, -6, -32, -76, -86, -8, 76, -46, 20, -80, 54, -88, -58, -48, -66, -66, 18, -28, -74, -72, -26, -92, -78, 24, -22, -80, -80, 82, -2, -72, -88, -54, -84, -8], [-30, 96, 92, -12, -14, -68, -16, 20, 74, -42, 36, 84, -82, 66, 44, 70, -92, -56, -28, -68, -4, 10, -4, 90, 72, 84, 68, 14, 32, 60, 40, 60, -34, 58, -56], 17, 0);
    console.log(`TEST-7...${result}`);
  
    result = driver([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, 1], [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, 1], 24, 24);
    console.log(`TEST-8...${result}`);
  
    result = driver([74, 75, 52, 58, 34, 53, 51, 45, 34, 28, 53, 94, 10, 20, 23, 12, 95, 78, 48, 11], [62, 56, 17, 1, 11, 30, 59, 18, 99, 21, 86, 49, 24, 85, 25, 56, 21, 66, 23, 96], 17, 0);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: findIndexOfAnExtraElementPresentInOneSortedArray
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js