#110. squareUp
squareUp
Background
Description
Given n>=0, create an array length n*n with the following pattern, shown here for n=3 : {0, 0, 1, 0, 2, 1, 3, 2, 1} (spaces added to show the 3 groups).
Format
Input
Output
Samples
3
[0, 0, 1, 0, 2, 1, 3, 2, 1]
2
[0, 1, 2, 1]
4
[0, 0, 0, 1, 0, 0, 2, 1, 0, 3, 2, 1, 4, 3, 2, 1]
Limitation
1s, 1024KiB for each test case.