Your question is Binary Search in Sorted Array. 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.
At Stripe, a service stores sorted numeric IDs in memory and needs fast lookups. Implement binary search to find the index of a target value in a sorted array.
Given a sorted list of integers nums in ascending order and an integer target, return the index of target if it exists. Otherwise, return -1.
nums (list of integers sorted in ascending order), target (integer)target, or -1 if not founddef binary_search(nums, target):