// javascript
const solution = (n) => {
return Array.from({ length: Math.floor(n / 2) }, (_, index) => (index + 1) * 2)
.reduce((sum, num) => sum + num, 0);
};
// typescript
const solution = (n:number):number => {
return Array.from({ length: Math.floor(n / 2) }, (_, index) => (index + 1) * 2)
.reduce((sum, num) => sum + num, 0);
};