human
Maximum number of partitions that can be sorted individually to make sorted | Function to find maximum partitions ..
Find maximum in prefix arr [ 0. . i ].
If maximum so far is equal to index , we can make a new partition ending at index i ..
Driver code"
Solution in Python:

What is a code to maximum number of partitions that can be sorted individually to make sorted and the other steps required?
assistant
#Here is code to maximum number of partitions that can be sorted individually to make sorted and the other steps required.
 def maxPartitions ( arr , n ) :
	ans = 0 ; max_so_far = 0
	for i in range ( 0 , n ) :
		max_so_far = max ( max_so_far , arr [ i ] )
		if ( max_so_far == i ) :
			ans += 1
	return ans
arr = [ 1 , 0 , 2 , 3 , 4 ]
n = len ( arr )
print ( maxPartitions ( arr , n ) )