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.
This is my Solution,
def almostIncreasingSequence(sequence):
def hasIncreasingOrder(slicedSquence, lengthOfArray):
count =0
output = True
while(count < (lengthOfArray-1)) :
if slicedSquence[count] >= slicedSquence[count+1] :
output = False
break
count = count +1
return output
count = 0
seqOutput = False
lengthOfArray = len(sequence)
while count < lengthOfArray:
newArray = sequence[:count] + sequence[count+1:]
if hasIncreasingOrder(newArray, lengthOfArray-1):
seqOutput = True
break
count = count+1
return seqOutput