human
Print the Maximum Subarray Sum | Function to print the elements of Subarray with maximum sum.
Initialize currMax and globalMax with first value of nums.
Iterate for all the elemensts of the array.
Update currMax.
Check if currMax is greater than globalMax.
Traverse in left direction to find start Index of subarray.
Decrement the start index.
Printing the elements of subarray with max sum.
Given array arr [ ].
Function call"
Solution in Python:

What is a code to print the Maximum Subarray Sum and the other steps required?
assistant
#Here is code to print the Maximum Subarray Sum and the other steps required.
 def SubarrayWithMaxSum ( nums ) :
	currMax = nums [ 0 ]
	globalMax = nums [ 0 ]
	for i in range ( 1 , len ( nums ) ) :
		currMax = max ( nums [ i ] , nums [ i ] + currMax )
		if ( currMax > globalMax ) :
			globalMax = currMax
			endIndex = i
	startIndex = endIndex
	while ( startIndex >= 0 ) :
		globalMax -= nums [ startIndex ]
		if ( globalMax == 0 ) :
			break
		startIndex -= 1
	for i in range ( startIndex , endIndex + 1 ) :
		print ( nums [ i ] , end = " ▁ " )
arr = [ - 2 , - 5 , 6 , - 2 , - 3 , 1 , 5 , - 6 ]
SubarrayWithMaxSum ( arr )