Hey,

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:

1 2
1 3
2 1
2 3
3 1
3 2

I am not sure if they would be generated in this order, but that's not relevant as long as there are no repetitions.

Thankyou

Regards,

miguel.pinr