human
Write me a code to print all the permutation of length L using the elements of an array and the other steps required given the following:
Print all the permutation of length L using the elements of an array | Iterative | Convert the number to Lth base and print the sequence.
Sequence is of Length L.
Print the ith element of sequence.
Print all the permuataions.
There can be ( Len ) ^ l permutations.
Convert i to Len th base.
Driver code.
function call"
Solution in Python:
assistant
#Here is code to print all the permutation of length L using the elements of an array and the other steps required.
 def convert_To_Len_th_base ( n , arr , Len , L ) :
	for i in range ( L ) :
		print ( arr [ n % Len ] , end = " " )
		n //= Len
	print ( )
def printf ( arr , Len , L ) :
	for i in range ( pow ( Len , L ) ) :
		convert_To_Len_th_base ( i , arr , Len , L )
arr = [ 1 , 2 , 3 ]
Len = len ( arr )
L = 2
printf ( arr , Len , L )