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.
Note: sequence a0
, a1
, ..., an
is considered to be a strictly increasing if a0 < a1 < ... < an
. Sequence containing only one element is also considered to be strictly increasing.
Input description
Funtion name: almostIncreasingSequence
Inputs:
sequence
:array.integer
- .
Output description
boolean
- Return true
if it is possible to remove one element from the array in order to get a strictly increasing sequence, otherwise return false
.