title: Find The First Missing Number
signature: class Solution {
  
      public int FindTheFirstMissingNumber(List<int> array, int start, int end_arg2) {
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> array, int start, int end_arg2, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(array, start, end_arg2); 
                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>{3, 6, 7, 9, 11, 14, 18, 30, 30, 32, 32, 34, 37, 44, 45, 45, 48, 48, 48, 52, 58, 60, 63, 67, 69, 69, 81, 83, 87, 89, 97, 99}, 24, 18, 
                  19
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{88, -62, 16, 80, 66, 78, 88, 38, 52, -96, 48, 98, 96, -62, 18, 34, -58, 30, -10, 26, -98, 48, -96, 4, 92, 36, 36, -36, -32, -70, 62, -58, -58, -84, 86, -98}, 19, 26, 
                  19
              );
              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, 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}, 26, 28, 
                  26
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{79, 99, 79, 85, 61, 58, 62, 61, 39, 87, 39, 74, 36, 70, 30, 43, 20, 52, 54, 50, 81, 98, 42}, 20, 20, 
                  20
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-98, -72, -46, -44, -42, -40, -16, -4, 62, 70, 74}, 8, 10, 
                  8
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 26, 23, 
                  24
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{58}, 0, 0, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{4, -84, -42, 12, -50, 42, -36, -38, -36, 98, -2, 20, 6, -96, -78, 24, 34, 88, 0, 74, 0, -8, -86, -68, -42, 98, -26, 86, -70, -32, -82, 78, 46, 58, 84, 4, -60, -90, -52, -78}, 37, 31, 
                  32
              );
              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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 28, 28, 
                  28
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{8}, 0, 0, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
source_py: def find_the_first_missing_number(array, start, end):
      if (start > end):
          return (end + 1)
      if (start != array[start]):
          return start
      mid = int(((start + end) / 2))
      if (array[mid] == mid):
          return find_the_first_missing_number(array, (mid + 1), end)
      return find_the_first_missing_number(array, start, mid)
source_cpp: int find_the_first_missing_number(vector<int> array, int start, int end) {
    if ( start > end ) return end + 1;
    if ( start != array [ start ] ) return start;
    int mid = ( start + end ) / 2;
    if ( array [ mid ] == mid ) return find_the_first_missing_number ( array, mid + 1, end );
    return find_the_first_missing_number ( array, start, mid );
  }