title: Floor In A Sorted Array 1
signature: floorInASortedArray1(arr, low, high, x) {
source_py: def floor_in_a_sorted_array_1(arr, low, high, x):
      if (low > high):
          return (- 1)
      if (x >= arr[high]):
          return high
      mid = int(((low + high) / 2))
      if (arr[mid] == x):
          return mid
      if ((mid > 0) and (arr[(mid - 1)] <= x) and (x < arr[mid])):
          return (mid - 1)
      if (x < arr[mid]):
          return floor_in_a_sorted_array_1(arr, low, (mid - 1), x)
      return floor_in_a_sorted_array_1(arr, (mid + 1), high, x)
source_cpp: int floor_in_a_sorted_array_1(vector<int> arr, int low, int high, int x) {
    if ( low > high ) return - 1;
    if ( x >= arr [ high ] ) return high;
    int mid = ( low + high ) / 2;
    if ( arr [ mid ] == x ) return mid;
    if ( mid > 0 && arr [ mid - 1 ] <= x && x < arr [ mid ] ) return mid - 1;
    if ( x < arr [ mid ] ) return floor_in_a_sorted_array_1 ( arr, low, mid - 1, x );
    return floor_in_a_sorted_array_1 ( arr, mid + 1, high, x );
  }