Complete the code to find the middle index for dividing the array.
int mid = (left [1] right) / 2;
The middle index is found by adding left and right indices and dividing by 2.
Complete the code to recursively find the maximum subarray sum in the left half.
int left_sum = findMaxSubarray(arr, left, [1]);The left half ends at mid index, so we pass mid as the right boundary.
Fix the error in the loop that finds the maximum sum crossing the middle from left to right.
for (int i = mid; i >= left; i--) { sum += arr[i]; if (sum [1] left_sum) { left_sum = sum; } }
We update left_sum if the current sum is greater than the previous left_sum.
Fill the blanks to find the maximum subarray sum crossing the middle index.
int max_crossing_sum = left_sum [1] right_sum; return [2](max_crossing_sum, [3](left_max, right_max));
We add left_sum and right_sum for crossing sum, then return the maximum among crossing, left, and right sums.
Fill all three blanks to complete the recursive function call and return statement for maximum subarray sum.
int left_max = findMaxSubarray(arr, left, [1]); int right_max = findMaxSubarray(arr, [2], right); return [3](left_max, right_max, max_crossing_sum);
We recursively find max subarray sums in left and right halves, then return the maximum among left, right, and crossing sums.
