#111. seriesUp
seriesUp
Background
Description
Given n>=0, create an array with the pattern {1, 1, 2, 1, 2, 3, ... 1, 2, 3 .. n} (spaces added to show the grouping). Note that the length of the array will be 1 + 2 + 3 ... + n, which is known to sum to exactly n*(n + 1)/2.
Format
Input
Output
Samples
3
[1, 1, 2, 1, 2, 3]
4
[1, 1, 2, 1, 2, 3, 1, 2, 3, 4]
2
[1, 1, 2]
Limitation
1s, 1024KiB for each test case.