human
Check if the array has an element which is equal to sum of all the remaining elements | function to check if such element exists or not.
storing frequency in dict.
stores the sum.
traverse the array and count the array element.
Only possible if sum is even.
if half sum is available.
Driver code"
How can the above be solved in Python?
 What is a code to check if the array has an element which is equal to sum of all the remaining elements and the other steps required?
assistant
#Here is code to check if the array has an element which is equal to sum of all the remaining elements and the other steps required.
 def isExists ( a , n ) :
	freq = { i : 0 for i in a }
	Sum = 0
	for i in range ( n ) :
		freq [ a [ i ] ] += 1
		Sum += a [ i ]
	if Sum % 2 == 0 :
		if freq [ Sum // 2 ] :
			return True
	return False
a = [ 5 , 1 , 2 , 2 ]
n = len ( a )
if isExists ( a , n ) :
	print ( " Yes " )
else :
	print ( " No " )