Cant figure out why the heck is this incorrect implementation of Binary Search in go.
Input is ([]int{-1, 0, 3, 5, 9, 12}, 9)
func Search(nums []int, target int) int {
mid := len(nums) / 2
if nums[mid] == target {
return mid
}
if len(nums) >= 1 {
if nums[mid] < target {
return Search(nums[mid+1:], target)
} else {
return Search(nums[:mid], target)
}
}
return -1
}