Kotlin Heroes: Episode 11 |
---|
Finished |
Yes, this is another one of those constructive permutation problems.
You are given an integer $$$n$$$. You have to construct a permutation $$$p$$$ of size $$$n$$$, i. e. an array of $$$n$$$ integers, where every integer from $$$1$$$ to $$$n$$$ appears exactly once.
Every pair of adjacent elements in the permutation ($$$p_i$$$ and $$$p_{i+1}$$$) must meet the following condition:
The first line contains one integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of test cases.
Each test case consists of one line, containing one integer $$$n$$$ ($$$2 \le n \le 100$$$).
For each test case, print the answer as follows:
2510
1 5 2 4 3 1 2 10 9 7 4 8 3 6 5
Name |
---|