Permutations with maximum difference between consecutive numbers
Answers
Answered by
0
Answer:
For N = 10, a permutation with distinct integers for consecutive absolute difference can be 1 10 2 9 3 8 4 7 5 6. The consecutive absolute difference gives integers 9, 8, 7 and so on. So, first print K integers of such a sequence then make the rest of the differences equal to 1
Similar questions