Your question is Binary Search and Efficiency. 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.
The Expedia app maintains a sorted list of unique property IDs for a search result page. Implement binary search to return the index of a target property ID, or -1 if the ID is not present.
Implement search_property_ids(property_ids, target):
property_ids is a sorted list of unique integers in ascending order.target is an integer property ID.target when it exists.-1 when target is absent.Your solution must use binary search rather than scanning every element. Explain why the search is efficient and state its time and space complexity.
def search_property_ids(property_ids, target):