You're given a circular integer array nums. Find the maximum possible sum of a non-empty subarray. Because the array is circular, the subarray can wrap around from the end to the beginning. Google interviewers use this to test whether you can extend Kadane's algorithm beyond the standard case.
For nums = [5, -3, 5], the best subarray wraps around: [5, 5] with sum .
Regular Kadane's handles the non-wrapping case. But how do you handle the case where the best subarray wraps around both ends of the array? That's the twist here.
Constraints: , values from to .