given an array of integers that is already sorted in ascending order find two numbers such that they add up to a specific target number the function twosum should return indices of the two numbers such that they add up to the target where index1 must be less than index2 please note that your returned answers both index1 and index2 are not zerobased you may assume that each input would have exactly one solution and you may not use the same element twice input numbers 2 7 11 15 target9 output index1 1 index2 2 solution twosum using binary search twosum1 using dictionary as a hash table twosum2 using two pointers given a list of numbers sorted in ascending order find the indices of two numbers such that their sum is the given target using binary search given a list of numbers find the indices of two numbers such that their sum is the given target using a hash table given a list of numbers sorted in ascending order find the indices of two numbers such that their sum is the given target using a bidirectional linear search given a list of numbers sorted in ascending order find the indices of two numbers such that their sum is the given target using binary search given a list of numbers find the indices of two numbers such that their sum is the given target using a hash table given a list of numbers sorted in ascending order find the indices of two numbers such that their sum is the given target using a bidirectional linear search pointer 1 holds from left of array numbers pointer 2 holds from right of array numbers
def two_sum(numbers, target):
    
    for i, number in enumerate(numbers):
        second_val = target - number
        low, high = i+1, len(numbers)-1
        while low <= high:
            mid = low + (high - low) // 2
            if second_val == numbers[mid]:
                return [i + 1, mid + 1]

            if second_val > numbers[mid]:
                low = mid + 1
            else:
                high = mid - 1
    return None

def two_sum1(numbers, target):
    
    dic = {}
    for i, num in enumerate(numbers):
        if target - num in dic:
            return [dic[target - num] + 1, i + 1]
        dic[num] = i
    return None

def two_sum2(numbers, target):
    
    left = 0                      
    right = len(numbers) - 1       
    while left < right:
        current_sum = numbers[left] + numbers[right]
        if current_sum == target:
            return [left + 1, right + 1]

        if current_sum > target:
            right = right - 1
        else:
            left = left + 1