This is my first post on here. I am currently studying python, and I've been doing some very "mathematical exercises" from a book I found online. I am also working on recursion, because it's one of my weak points. I can do some permutations with my code recursively, but I'm sort of stumped on a problem that I can't really solve. I am supposed to find all permutations from a list. They have to be of k-size. The catch is that they have a pattern that I'm struggling to code for some reason :/

Basically, if I have an array like=[1,2,3,4] and n=4, a valid output would be [[1,2,1,2], [2,1,2,1], [1,4,1,4] ,etc...]

English is not my first language, but I believe you could call it a criss-cross pattern(?).

This is my code for the regular permutations:

Python:

```
def comb(k,array):
if k<=0:
return [[]]
else:
final=[]
for part in comb(k-1,array):
for e in array:
final.append([e]+part)
return final
```