New update is available. Click here to update.

Last Updated: 12 Mar, 2021

Difficulty: Moderate

```
1. 1 occurs in the sequence exactly once.
2. Each integer between 2 to N(inclusive) occurs in the sequence exactly twice.
3. For each integer i between 2 to N, the distance between the two occurrences of i should be exactly i.
```

```
1. A sequence A is lexicographically larger than a sequence B (of the same length), if in the first position where A and B differ, sequence A has a number greater than the corresponding number in B.
2. It is guaranteed that under the given constraints, there is always a solution.
```

```
The first line contains an integer, ‘T’ which denotes the number of test cases or queries to be run. Then, the T test cases follow.
The first and the only line of each test case contains one integer N, as described in the problem statement.
```

```
For each test case, print in a new line, 2*'N' - 1 space-separated integer representing the lexicographically largest sequence for the given input.
```

```
You do not need to print anything. It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 100
1 <= N <= 20
Time Limit: 1 second
```

SIMILAR PROBLEMS

Prime Digit Sum

Posted: 17 Apr, 2022

Difficulty: Hard

Prime Digit Sum

Posted: 17 Apr, 2022

Difficulty: Hard

Mario And His Princess

Posted: 12 May, 2022

Difficulty: Moderate

Combination Sum III

Posted: 25 May, 2022

Difficulty: Moderate

Combination Sum III

Posted: 25 May, 2022

Difficulty: Moderate

Combination Sum III

Posted: 25 May, 2022

Difficulty: Moderate

Generate All Strings

Posted: 9 Jul, 2022

Difficulty: Moderate

8-Queen Problem

Posted: 19 Dec, 2022

Difficulty: Easy

Popular Interview Problems: