human
Construct a K | Function to construct binary string according to the given conditions.
Initialize with 1.
Traverse the array.
To check if the i - th eger needs to be considered or not.
Print the binary string for i in range ( 1 , K ) : print ( bit [ i ] ).
Given array.
Size of the array.
Given K"
Solution in Python:
assistant
#Here is code to construct a K and the other steps required.
 def constructBinaryString ( arr , N , K ) :
	bit = 1
	for i in range ( 0 , N ) :
		bit |= bit << arr [ i ]
	bit = bin ( bit ) . replace ( "0b " , " " )
	print ( bit [ 1 : K + 1 ] )
arr = [ 1 , 6 , 1 ]
N = len ( arr )
K = 8
constructBinaryString ( arr , N , K )