115. Maximum Sum Circular Subarray
Medium · Array
Given a circular array of integers, find the maximum possible sum of a non-empty contiguous subarray. Because the array is circular, a subarray may wrap around from the end back to the beginning, but each element may be used at most once.
The input is the array. Return a single integer — the maximum circular subarray sum.
Examples
Example 1 Input: [1,-2,3,-2] Output: 3 Explanation: Subarray [3] gives the largest sum.
Example 2 Input: [5,-3,5] Output: 10 Explanation: Wrapping around: [5] + [5] = 10.
Constraints
- Standard input/output constraints apply