Your question is Implement Binary Search Algorithm. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Implement a binary search algorithm that finds the index of a target value in a sorted array. If the target value is not found, return -1.
nums.target to search for.target in nums or -1 if target is not present.def binary_search(nums: list[int], target: int) -> int: