human
Largest value of K that a set of all possible subset | Function to find maximum count of consecutive integers from 0 in set S of all possible subset - sum.
Stores the maximum possible integer.
Sort the given array in non - decrasing order.
Iterate the given array.
If arr [ i ] <= X + 1 , then update X otherwise break the loop.
Return Answer.
Driver Code"
How can the above be solved in Python?
 Write me a code to largest value of K that a set of all possible subset and the other steps required?
assistant
#Here is code to largest value of K that a set of all possible subset and the other steps required.
 def maxConsecutiveCnt ( arr ) :
	X = 0
	arr . sort ( )
	for i in range ( 0 , len ( arr ) ) :
		if ( arr [ i ] <= ( X + 1 ) ) :
			X = X + arr [ i ]
		else :
			break
	return X + 1
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 1 , 1 , 4 ]
	print ( maxConsecutiveCnt ( arr ) )