Given an integer n, construct a sequence of length n
The integer
Every integer i from n appears exactly twice in the sequence.
For each integer i between n, the distance between the two occurrences of i is exactly i. That is, if the first occurrence is at index j, the second occurrence is at index j + i.
Return the lexicographically largest valid sequence. It is guaranteed that a valid sequence always exists for the given constraints.
A sequence a is lexicographically larger than a sequence b of the same length if, at the first index where a and b differ, the element in a is greater than the element in b.
Constraints:
n
Given an integer n, construct a sequence of length n
The integer
Every integer i from n appears exactly twice in the sequence.
For each integer i between n, the distance between the two occurrences of i is exactly i. That is, if the first occurrence is at index j, the second occurrence is at index j + i.
Return the lexicographically largest valid sequence. It is guaranteed that a valid sequence always exists for the given constraints.
A sequence a is lexicographically larger than a sequence b of the same length if, at the first index where a and b differ, the element in a is greater than the element in b.
Constraints:
n