Skip to content

Commit 5fdac30

Browse files
authored
PERMUTATION CREATE (#133)
2 parents 550403b + c64ca47 commit 5fdac30

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
// your code goes here
6+
7+
long long number;
8+
cin >> number;
9+
for(int i = 0; i < number; i++){
10+
long long a;
11+
cin >> a;
12+
if(a < 4){
13+
cout << -1 << endl;
14+
}
15+
else if( a == 4){
16+
cout << 2 << " " << 4 << " " << 1 << " " << 3 ;
17+
}
18+
else{
19+
for(long long i = 1; i <= a; i = i+2){
20+
cout << i << " " ;
21+
}
22+
for(long long i = 2; i <= a; i = i+2){
23+
cout << i << " ";
24+
}
25+
}
26+
cout << endl;
27+
}
28+
29+
30+
31+
32+
33+
return 0;
34+
}

0 commit comments

Comments
 (0)