human
Check if a subarray exists with sum greater than the given Array | Function to check whether there exists a subarray whose sum is greater than or equal to sum of given array elements.
Initialize sum with 0.
Checking possible prefix subarrays . If sum of them is less than or equal to zero , then return 1.
again reset sum to zero.
Checking possible suffix subarrays . If sum of them is less than or equal to zero , then return 1.
Otherwise return 0.
Driver Code"
Solution in Python:
assistant
#Here is code to check if a subarray exists with sum greater than the given Array and the other steps required.
 def subarrayPossible ( arr , n ) :
	sum = 0 ;
	for i in range ( n ) :
		sum += arr [ i ] ;
		if ( sum <= 0 ) :
			return True ;
	sum = 0 ;
	for i in range ( n - 1 , - 1 , - 1 ) :
		sum += arr [ i ] ;
		if ( sum <= 0 ) :
			return True ;
	return False ;
if __name__ == ' _ _ main _ _ ' :
	arr = [ 10 , 5 , - 12 , 7 , - 10 , 20 , 30 , - 10 , 50 , 60 ] ;
	size = len ( arr ) ;
	if ( subarrayPossible ( arr , size ) ) :
		print ( " Yes " ) ;
	else :
		print ( " No " ) ;