0
def almostIncreasingSequence(sequence):
x = sequence
for i in range(len(x)):
sequence = x
cont = 0
y = False
sequence.remove(sequence[i])
for j in range(len(sequence)):
try:
if sequence[j] < sequence[j+1]:
cont += 1
if cont == (len(sequence)-2):
y = True
except:
if sequence[-1] > sequence[-2]:
cont += 1
if cont == len(sequence)-1:
if y == True:
pass
else:
y = False
return y
I have a problem with this code, because when I use the remove in the Quence list, in addition to removing the element in the Quence list, but as it also removes the same element from the x list, I would like to know how to fix this, or if it is not possible using the remove, whether it is possible to have a variable to store the Quence list without changing it.
What this function needs to do?
– Woss
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.
– Angelo Gonçalves Salles
I still have the same problem, when I remove the item from the list Quence, it keeps deleting from the list x too
– Angelo Gonçalves Salles