title: Almost increasing sequence in python
body: <p>The goal of the code is to see if a sequence is almost increasing, that is, it can be made strictly increasing by removing a single element.</p>
  
  <p>For example: [1, 3, 2, 3] would be strictly increasing if the element at index 1 were removed. [1, 2, 1, 2] is not almost increasing because if you removed the first '2', you would get [1, 1, 2] which is not strictly increasing.</p>
  
  <p>My code has to work in under 4000 ms for a sequence of length 2 &lt;= len &lt;= 10^5. It is likely getting caught up on very long sequences.</p>
  
  <pre><code>def almostIncreasingSequence(sequence):
      length = len(sequence)
      count = 0
  
      for previous, next in zip(sequence[:-1],sequence[1:]):
          if previous &lt; next:
              count +=1
  
      if (length-count&gt;2):
          return False
      return True
  </code></pre>
  
  <p>[1, 2, 1, 2]</p>
  
  <p>[1, 2, 3, 4, 5, 3, 5, 6]</p>
  
  <p>[40, 50, 60, 10, 20, 30]</p>
  
  <p>would not work.. any help please</p>
  
  <p>Please note that this is not a homework question, as most of you guys know, there are lots of answers to this question posted online and i was wondering if i can do it this way</p>