Yngvarr

Generation

generate functionFri, 14 Apr 2023

search in array

nums = [1, 2, 3, 4] il = 0 ir = len(nums) - 1 while il <= ir: m = (il + ir) // 2 if target > nums[m]: il = m + 1 elif target < nums[m]: ir = m - 1 else: return m return -1

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant