I'm having some trouble in finding a solution for this problem. Which is:
I need a function that given an array with a number of elements n, and a positive integer k <= n, returns the next k-permutation of the array.
For example if k=2, the array (1,2,3) would have the following permutations:
I am not sure if they would be generated in this order, but that's not relevant as long as there are no repetitions.