human
Making zero array by decrementing pairs of adjacent | Python3 program to find if it is possible to make all array elements 0 by decrement operations ..
used for storing the sum of even and odd position element in array ..
if position is odd , store sum value of odd position in odd.
if position is even , store sum value of even position in even.
Driver Code"
Solution in Python:
 ... Can you provide a code to making zero array by decrementing pairs of adjacent and the other steps required?
assistant
#Here is code to making zero array by decrementing pairs of adjacent and the other steps required.
 def isPossibleToZero ( a , n ) :
	even = 0 ;
	odd = 0 ;
	for i in range ( n ) :
		if ( i & 1 ) :
			odd += a [ i ] ;
		else :
			even += a [ i ] ;
	return ( odd == even ) ;
arr = [ 0 , 1 , 1 , 0 ] ;
n = len ( arr ) ;
if ( isPossibleToZero ( arr , n ) ) :
	print ( " YES " ) ;
else :
	print ( " NO " ) ;