function _doAlmostIncreasingSequence(_seq, recheck) {
var warning = 0;
var _control = _seq[0] - 1;
for (var i = 0; i < _seq.length; i++) {
var _test = _seq[i];
if (_test <= _control) {
if (recheck) {
var test1 = _seq.slice(0);
var test2 = _seq.slice(0);
test1.splice(i, 1);
test2.splice(i - 1, 1);
return _doAlmostIncreasingSequence(test1) || _doAlmostIncreasingSequence(test2);
}
return false;
}
_control = _test;
}
return true;
}
function almostIncreasingSequence(_seq) {
return _doAlmostIncreasingSequence(_seq, 1);
}
console.log("TRUE :", almostIncreasingSequence([1, 2, 3, 5, 4, 5, 6]));
console.log("TRUE :", almostIncreasingSequence([10, 1, 2, 3, 4, 5, 6]));
console.log("TRUE :", almostIncreasingSequence([4, 5, 6, 6, 7, 8]));
console.log("FALSE :", almostIncreasingSequence([4, 5, 6, 1, 2, 3]));
console.log("TRUE :", almostIncreasingSequence([1, 3, 4, 6, 7, 8, 1, 10, 11, 12]));
console.log("FALSE :", almostIncreasingSequence([1, 3, 2, 1]));
console.log("FALSE :", almostIncreasingSequence([1, 2, 5, 5, 5]));
console.log("TRUE :", almostIncreasingSequence([1, 2, 3, 4, 3, 6]));