I'm trying to do this codefights task:
Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array.
So here's my code:
def almostIncreasingSequence(sequence):
def checa(sequence):
cont = 0
copia1 = copia2 = sequence
for i in range(len(sequence)-1):
while(cont == 0):
if(sequence[i] >= sequence[i+1]):
del(copia1[i])
del(copia2[i+1])
cont += 1
if(all(copia1[j] < copia1[j+1] for j in range(len(copia1)-1)) == True):
return True
elif(all(copia2[j] < copia2[j+1] for j in range(len(copia2)-1)) == True):
return True
else:
return False
I can't see my flaws here and it's returning None
every single time.