P17967 [GeeksforGeeks] Generate all cyclic permutations of a number2921
普及-
题目描述

Given a number N, generate all the possible cyclic permutations of the number.
Example 1:
Input:
N = 123
Output:
123 312 231
Explanation:
For 123 there are 3 cyclic permutations possible.
Example 2:
Input:
N = 5674
Output:
5674 4567 7456 6745
Explanation:
For 5674 there are 4 cyclic permutations possible.
Your Task:
You don't need to read input or print anything. Your task is to complete the function cyclicPermutations() which takes an integer N as input parameter and returns the list of unique cyclic permutations of N.
Note: Cyclic permutation should not contain leading zeros
Expected Time Complexity: O(X)
Expected Auxiliary Space: O(X), Where X is the number of the digit of N.
Constraints:
1 <= N <= 10^{9}

输入格式

见题面

输出格式

见题面

样例输入
N = 123
样例输出
123 312 231