# Task
 Given a `sequence` of integers, check whether it is possible to obtain a strictly increasing sequence by erasing no more than one element from it.

# Example

 For `sequence = [1, 3, 2, 1]`, the output should be `false`;
 
 For `sequence = [1, 3, 2]`, the output should be `true`.

# Input/Output


 - `[input]` integer array `sequence`

    Constraints: `2 ≤ sequence.length ≤ 1000, -10000 ≤ sequence[i] ≤ 10000.`


 - `[output]` a boolean value

    `true` if it is possible, `false` otherwise.

Difficulty: introductory

Starter code:

def almost_increasing_sequence(sequence):
	

Solutions:
def almost_increasing_sequence(sequence):
    save, first = -float('inf'), True
    for i,x in enumerate(sequence):
        if x > save: save = x
        elif first:
            if i == 1 or x > sequence[i-2]: save = x
            first = False
        else: return False
    return True

is_increasing_sequence = lambda a: all(x < y for x, y in zip(a, a[1:]))
almost_increasing_sequence = lambda a: any(is_increasing_sequence(a[:i] + a[i+1:]) for i in range(len(a)))

def almost_increasing_sequence(sequence):
    
    for n,i in enumerate(sequence):
        lis = sequence.copy()
        del(lis[n])
        if len(lis) == len(set(lis)): 
            if sorted(lis) == lis :
                return True

    return False

def almost_increasing_sequence(arr):
    li,i = [],0
    while i < len(arr):
        temp = []
        while i + 1 < len(arr) and arr[i] < arr[i + 1]:
            temp.append(arr[i]) ; i += 1
        li.append(temp) ; i += 1
    return len(li) <= 2 and all(j[-1]<li[i+1][0] for i,j in enumerate(li[:-1]) if j and li[i+1])

def almost_increasing_sequence(sequence):
    prev = sequence[0] - 1
    n = 0
    for i, x in enumerate(sequence):
        if x <= prev:
            if n:
                return False
            n = 1
            if i > 1 and sequence[i-2] >= x:
                continue
        prev = x
    return True

def almost_increasing_sequence(seq):
    l = [ i for i,(a,b) in enumerate(zip(seq[:-1], seq[1:])) if a >= b ]
    return not l or len(l) == 1 and ( l[0] == 0 or l[0] == len(seq)-2 or seq[l[0]-1] < seq[l[0]+1] or seq[l[0]] < seq[l[0]+2])

def almost_increasing_sequence(s):
    p=-1
    l=len(s)
    for i in range(l-1):
        if s[i]>=s[i+1]:
            if p>=0: return False
            p=i
    return p<=0 or p==l-2 or s[p-1]<=s[p+1]

almost_increasing_sequence=lambda a:sum((y>=z)*(2-(x<z))for x,y,z in zip([a[1]-1]+a[:-3]+[a[-1]-1],a,a[1:]))<2

def almost_increasing_sequence(sequence):
    to_remove = 0
    min_ = sequence[0]
    for i in range(len(sequence)-1):
        if sequence[i] >= sequence[i+1]:
            to_remove += 1
            if sequence[i+1] < min_ and min_ != sequence[i]:
                return False
            if to_remove == 2:
                return False
            min_ = sequence[i+1]
    return True

def almost_increasing_sequence(sequence):
    if len(sequence)>2:
        for i in range(len(sequence)-1):
            if sequence[i]>=sequence[i+1] and sequence[i+1]!=sequence[-1]:
                sequence.remove(sequence[i])
                for j in range(len(sequence)-1):
                    if sequence[j]>=sequence[j+1]:
                        return False
                return True
    return True