Created
          February 25, 2017 22:23 
        
      - 
      
- 
        Save Underdoge/378a21bc98f8175a7c40876e6584ab38 to your computer and use it in GitHub Desktop. 
    almostIncreasingSequence
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function almostIncreasingSequence(sequence){ | |
| var errors=0; | |
| for(var i=0;i+1<sequence.length&&errors<2;i++) | |
| if(sequence[i]>=sequence[i+1]){ | |
| errors++; | |
| if(i+2<sequence.length&&i>0) | |
| if(sequence[i]>=sequence[i+2]) | |
| errors++; | |
| } | |
| return errors<=1; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment