text: int binary_search(int *arr, int l, int r, int x)
  {
      if (r >= l) {
          int mid = l + (r - l) / 2;
          
          if (arr[mid] == x)
              return mid;
          if (x > arr[mid] && x <= arr[mid+1]) {
              return mid + 1;
          }
          
          if (arr[mid] > x)
              return binary_search(arr, l, mid - 1, x);
          
          return binary_search(arr, mid + 1, r, x);
      }
      return -1;
  }
  
  int searchInsert(int* nums, int numsSize, int target)
  {
      int res = binary_search(nums, 0, numsSize - 1, target);
      printf("%d", res);
      return 0;
  }
  