Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
if(n & 1) {
puts("-1");
return 0;
}
for(int i = 0; i < n; i += 2)
printf("%d %d ", i + 2, i + 1);
puts("");
return 0;
}
Copy The Code &
Try With Live Editor
Input
1
Output
-1
Demonstration
Codeforcess Solution Perfect Permutation, A. Perfect Permutation ,C,C++, Java, Js and Python ,Perfect Permutation,Codeforcess Solution