function solution(num, total) {
let start = 0;
let sum = new Array(num).fill(0).map((a,i) => i).reduce((a,b) => a+b, 0);
while (sum !== total) {
if (sum < total) {
start++
} else {
start--
}
sum = new Array(num).fill(0).map((a,i) => i+start).reduce((a,b) => a+b, 0);
}
return new Array(num).fill(0).map((a,i) => i+start);
}
function solution(num, total) {
var min = Math.ceil(total/num - Math.floor(num/2));
var max = Math.floor(total/num + Math.floor(num/2));
return new Array(max-min+1).fill(0).map((el,i)=>{return i+min;});
}
function solution(num, total) {
const a = (2 * total / num + 1 - num) / 2
return Array(num).fill().map((_, i) => i + a)
}