What is the time complexity of the binary search algorithm?
Asked in the Technical interview stage. Implement iterative binary search to apply the complexity being tested.
Given a sorted list of integers nums in ascending order and an integer target, return the index of target, or -1 if it is absent. If duplicates exist, return any matching index.
Function signature: def binary_search(nums, target):
def binary_search(nums, target):