F6SQX7AKDBZRO2W6G233FZWFBKF5GQXBX64WCT3TSZ5TLZUAMPLQC
// Package binarysearch is a simple binary search algorithm.
package binarysearch
// SearchInts tries to fing target in input slice.
func SearchInts(slice []int, target int) int {
left := 0
right := len(slice) - 1
for left <= right {
mark := (left + right) / 2
switch {
case slice[mark] < target:
left = mark + 1
case slice[mark] > target:
right = mark - 1
default:
return mark
}
}
return -1
}