Max sum in a circular array (where subarrays can wrap around)
Asked in the Round 2 DSA + Java stage. Followed by discussion on Java fundamentals.
Implement max_circular_subarray_sum(nums). The input is a non-empty list of integers. Return the largest sum of a non-empty contiguous subarray, allowing the subarray to wrap from the last element to the first.
Example: [5, -3, 5] returns 10; [-3, -2, -1] returns -1.
Function signature: def max_circular_subarray_sum(nums):
def max_circular_subarray_sum(nums):