You immediate problem is
Quote:
while(i<sequence.size())
You have to change it to
while(i < (sequence.size() - 1) )
However that's not enough.
First of all you have to replace
>
with
>=
in comparisons (because it should be a
strictly increasing sequence), then you shoud try to remove either
sequence[i]
or
sequence[i+1]
, accepting the first one that preserves locally the
incresing property. Lastly '
you can work on points of style' e.g. return
false
whenever
count>1
instead of waiting the end of the loop.