Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
ascending_list solution in Clear category for Ascending List by Jon_Red
import assert from'assert';
function isAscending(values:number[]):boolean{
return values.every((e,i)=>values.indexOf(e)===i&&(
!values.indexOf(e)||e>values[values.indexOf(e)-1]
));
}
// self-checks
assert.equal(isAscending([-5,10,99,123456]),true);
assert.equal(isAscending([99]),true);
assert.equal(isAscending([4,5,6,7,3,7,9]),false);
assert.equal(isAscending([]),true);
assert.equal(isAscending([1,1,1,1]),false);
Aug. 1, 2020