title: How to get almost increasing sequence of integers
body: <p>Given a sequence of integers as an array,i have to determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array. Example  </p>
  
  <p>For <code>sequence = [1, 3, 2, 1]</code>, the output should be </p>
  
  <pre><code>almostIncreasingSequence(sequence) = false
  </code></pre>
  
  <p>There is no one element in this array that can be removed in order to get a strictly increasing sequence.</p>
  
  <p>For <code>sequence = [1, 3, 2]</code> the output should be </p>
  
  <pre><code>almostIncreasingSequence(sequence) = true
  </code></pre>
  
  <p>We can remove <code>3</code> from the array to get the strictly increasing sequence <code>[1, 2]</code>. Alternately, we can remove <code>2</code> to get the strictly increasing sequence <code>[1, 3].</code></p>
  
  <p>The function must return <code>true</code> if it is possible to remove one element from the array in order to get a strictly increasing sequence, otherwise return <code>false.</code></p>
  
  <p>Here is what i have already tried , but it doesnt work for all situations </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function almostIncreasingSequence(sequence) {
      for (var i = 0; i &lt; sequence.length; i++) {
          if (sequence[i] &gt; sequence[i + 1]) {
              sequence.splice(i, 1);
             return true;
          };
          return false;
      };
  }</code></pre>
  </div>
  </div>
  </p>