Binary search — find index
Return the index of target in the ascending-sorted nums, or -1 if absent.
func search(nums []int, target int) int {lo, hi := 0, len(nums)-1for lo <= hi {mid := (lo + hi) / 2if nums[mid] == target {return mid} else if nums[mid] < target {} else {}}return -1}
this session — 0 attempt(s), 0 passed, 0 failed. (ephemeral; discarded when you leave)