Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def increasingSequence(seq): # auxiliar
- for i in range(1,len(seq)):
- if seq[i-1]>=seq[i]:
- return False
- else: return True
- def almostIncreasingSequence(sequence): # principal
- for i in range(len(sequence)):
- inic = sequence[:i]
- tail = sequence[i+1:]
- inc_inic = increasingSequence(inic)
- inc_tail = increasingSequence(tail)
- cond = inic[-1]<tail[0] if len(inic)*len(tail) else True
- if inc_inic and inc_tail and cond : # si, este codigo da asco, gracias
- return True
- else: return False
Advertisement
Add Comment
Please, Sign In to add comment