human
Minimize length of an array by removing similar subarrays from both ends | Function to minimize length of the array by removing similar subarrays from both ends of the array.
Initialize two pointers.
Stores the current integer.
Check if the elements at both ends are same or not.
Move the front pointer.
Move the rear pointer.
Print the minimized length of the array.
Input.
Function call to find the minimized length of the array"
How can the above be solved in Python?

=====
Write me a code to minimize length of an array by removing similar subarrays from both ends and the other steps required?
assistant
#Here is code to minimize length of an array by removing similar subarrays from both ends and the other steps required.
 def findMinLength ( arr , N ) :
	front = 0
	back = N - 1
	while ( front < back ) :
		x = arr [ front ]
		if arr [ front ] != arr [ back ] :
			break
		while ( arr [ front ] == x and front <= back ) :
			front += 1
		while ( arr [ back ] == x and front <= back ) :
			back -= 1
	print ( back - front + 1 )
arr = [ 1 , 1 , 2 , 3 , 3 , 1 , 2 , 2 , 1 ]
N = len ( arr )
findMinLength ( arr , N )