<qiyuangong>074_Search_a_2D_Matrix_1.py
def search_row( matrix, row, target):
    if target < matrix[row][0]:
        return -1
    elif target > matrix[row][-1]:
        return 1
    begin, end = 0, len(matrix[row]) - 1
    while begin <= end:
        mid = (begin + end) / 2
        if matrix[row][mid] == target:
            return 0
        elif matrix[row][mid] < target:
            begin = mid + 1
        else:
            end = mid - 1
    return 1
def sample_funcname ( var_0 , var_1 , var_2 ) :
    if var_2 < var_0 [ var_1 ] [ 0 ] :
        return - 1
    elif var_2 > var_0 [ var_1 ] [ - 1 ] :
        return 1
    var_5 , var_7 = 0 , len ( var_0 [ var_1 ] ) - 1
    while var_5 <= var_7 :
        var_9 = ( var_5 + var_7 ) / 2
        if var_0 [ var_1 ] [ var_9 ] == var_2 :
            return 0
        elif var_0 [ var_1 ] [ var_9 ] < var_2 :
            var_5 = var_9 + 1
        else :
            var_7 = var_9 - 1
    return 1
