(self, nums: List[int], target: int)
| 1 | def binary_search(self, nums: List[int], target: int) -> int: |
| 2 | |
| 3 | low = 0 |
| 4 | high = len(nums)-1 |
| 5 | while low <= high: |
| 6 | mid = (low + high) // 2 |
| 7 | if nums[mid] == target: |
| 8 | return mid |
| 9 | elif nums[mid] < target : |
| 10 | low = mid + 1 |
| 11 | else: |
| 12 | high = mid - 1 |
| 13 | return -1 |
nothing calls this directly
no outgoing calls
no test coverage detected