Finding if permutations exist of two numbers that equate to c
Answers
Answered by
0
Answer:
Given a number N, our task is to generate all the possible cyclic permutations of the number.
A cyclic permutation shifts all the elements of a set by a fixed offset. For a set with elements
a_0,
a_1, …,
a_n, a cyclic permutation of one place to the left would yield
a_1, …,
a_n,
a_0, and a cyclic permutation of one place to the right would yield
a_n,
a_0,
a_1, ….
Examples:
Input : 123
Output : 123
312
231
Input : 5674
Output : 5674
4567
7456
6745
Similar questions