Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 536 Bytes

File metadata and controls

19 lines (14 loc) · 536 Bytes

Problem 17: Infinite Loop Wealth

Problem Statement

Given a circular integer array nums (the next element of nums[n-1] is nums[0]), find the maximum possible sum of a non-empty subarray of nums.

Input Format

  • An array of integers nums.

Output Format

  • An integer representing the maximum circular subarray sum.

Constraints

  • 1 <= nums.length <= 3 * 10^4
  • -30,000 <= nums[i] <= 30,000

Example

Input: nums = [5, -3, 5]
Output: 10
Explanation: [5, 5] (circularly) has the maximum sum = 10.