Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Create Intervals by Moff
function createIntervals(data) {
data.sort((a, b) => a - b);
let current, result = [];
for (let n of data) {
if (current && n === current[1] + 1) {
current[1] = n;
} else {
current = [n, n];
result.push(current);
}
}
return result;
}
July 31, 2017
Comments: