(nums []int, target int)
| 5 | } |
| 6 | |
| 7 | func search(nums []int, target int) int { |
| 8 | if nums[0] <= target { |
| 9 | for i := 0; i <= len(nums)-1 && nums[i] <= target; i++ { |
| 10 | if nums[i] == target { |
| 11 | return i |
| 12 | } |
| 13 | } |
| 14 | return -1 |
| 15 | } |
| 16 | |
| 17 | for i := len(nums) - 1; i >= 0 && nums[i] >= target; i-- { |
| 18 | if nums[i] == target { |
| 19 | return i |
| 20 | } |
| 21 | } |
| 22 | return -1 |
| 23 | } |
nothing calls this directly
no outgoing calls
no test coverage detected