Hi, I am tried to search for this problem on leetcode but I could not find it anywhere, can you help me find this problem or a similar one
Given a number n, create an array of size 2n such that the array contains 2 instances of every number from 1 to n, and the number of elements between two instances of a number i is equal to i. If such a configuration is not possible, then print the same.
Examples:
Input: n = 3
Output: res[] = {3, 1, 2, 1, 3, 2}
Input: n = 2
Output: Not Possible
Input: n = 4
Output: res[] = {4, 1, 3, 1, 2, 4, 3, 2}