human
Count of Subsets containing only the given value K | Function to find the number of subsets formed by the given value K.
Count is used to maintain the number of continuous K 's.
Iterating through the array.
If the element in the array is equal to K.
count * ( count + 1 ) / 2 is the total number of subsets with only K as their element.
Change count to 0 because other element apart from K has been found.
To handle the last set of K 's.
Driver code"
Solution in Python:
 ... Give me a code to count of Subsets containing only the given value K and the other steps required?
assistant
#Here is code to count of Subsets containing only the given value K and the other steps required.
 def count ( arr , N , K ) :
	count = 0
	ans = 0
	for i in range ( N ) :
		if ( arr [ i ] == K ) :
			count = count + 1
		else :
			ans += ( count * ( count + 1 ) ) // 2
			count = 0
	ans = ans + ( count * ( count + 1 ) ) // 2
	return ans
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 0 , 0 , 1 , 1 , 0 , 0 ]
	N = len ( arr )
	K = 0
	print ( count ( arr , N , K ) )