Explanation Some modification so that we can print the starting and ending index of the subarray which holds maximum sum .