human
Find a subarray whose sum is divisible by size of the array | Function to check is there exists a subarray whose sum is a multiple of N.
Prefix sum array to store cumulative sum.
Single state dynamic programming relation for prefix sum array.
Modulo class vector.
Storing the index value in the modulo class vector.
If there exists a sub - array with starting index equal to zero.
In this class , there are more than two presums % N Hence difference of any two subarrays would be a multiple of N.
0 based indexing.
Driver code"
How can the above be solved in Python?

=====
What is a code to find a subarray whose sum is divisible by size of the array and the other steps required?
assistant
#Here is code to find a subarray whose sum is divisible by size of the array and the other steps required.
 def CheckSubarray ( arr , N ) :
	presum = [ 0 for i in range ( N + 1 ) ]
	for i in range ( 1 , N + 1 ) :
		presum [ i ] = presum [ i - 1 ] + arr [ i - 1 ]
	moduloclass = [ [ ] ] * N
	for i in range ( 1 , N + 1 , 1 ) :
		moduloclass [ presum [ i ] % N ] . append ( i - 1 )
	if ( len ( moduloclass [ 0 ] ) > 0 ) :
		print ( 0 + 1 , moduloclass [ 0 ] [ 0 ] + 2 )
		return
	for i in range ( 1 , N ) :
		if ( len ( moduloclass [ i ] ) >= 2 ) :
			print ( moduloclass [ i ] [ 0 ] + 1 , moduloclass [ i ] [ 1 ] )
			return
if __name__ == ' _ _ main _ _ ' :
	arr = [ 7 , 3 , 5 , 2 ]
	N = len ( arr )
	CheckSubarray ( arr , N )