Maximum Circular Subarray — Solution & Editorial
A wrapping subarray is the complement of a normal one: its sum is total − (minimum subarray). Answer = max(normal Kadane, total − min-Kadane), except when the min subarray is the whole array (all negatives) — then the plain Kadane answer stands.
Complexity: O(N)
Watch out: The all-negative case: total − min would pick an empty wrap — exclude it explicitly.