funcbinarySearch(arr []int, target int)int { if arr == nil { return-1 } left, right := 0, len(arr)-1
for left <= right { mid := left + (right-left)/2 if arr[mid] == target { right = mid - 1 } elseif arr[mid] >= target { right = mid - 1 } else { left = mid + 1 } } return left }