human
Can you provide a code to count of subsets not containing adjacent elements and the other steps required given the following:
Count of subsets not containing adjacent elements | Function to return the count of possible subsets.
Total possible subsets of n sized array is ( 2 ^ n - 1 ).
To store the required count of subsets.
Run from i 000. .0 to 111. .1.
If current subset has consecutive elements from the array.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to count of subsets not containing adjacent elements and the other steps required.
 def cntSubsets ( arr , n ) :
	max = pow ( 2 , n )
	result = 0
	for i in range ( max ) :
		counter = i
		if ( counter & ( counter >> 1 ) ) :
			continue
		result += 1
	return result
arr = [ 3 , 5 , 7 ]
n = len ( arr )
print ( cntSubsets ( arr , n ) )