MANTECH systems may need to locate a telemetry record ID in a sorted sequence before processing it. Implement binary search for a sorted list of distinct integers, without adding low or high parameters to the required public function.
Your function must be named binary_search(nums, target) and return the zero-based index of target. Return -1 when the target is absent. You may define a nested helper function with internal search bounds, or use an iterative approach, but the public function signature must remain unchanged.
nums, a list of distinct integers sorted in ascending order, and target, an integer.nums[index] == target, or -1 if no such index exists.def binary_search(nums, target):