Tap here to switch tabs
Problem
Submissions

Problem: Maximum Sum Circular Subarray

med
30 min
Try to solve the Maximum Sum Circular Subarray problem.

Statement

Given an integer array nums representing a circular array, return the maximum possible sum of a non empty subarray of nums.

A subarray is a contiguous sequence of elements. Because nums is circular, a subarray may wrap from the end of the array back to the beginning, but each element of nums can be included at most once in the chosen subarray.

Constraints:

  • n == nums.length

  • 1≤1 \leq n ≤3⋅104\leq 3 \cdot 10^4

  • −3⋅104≤-3 \cdot 10^4 \leq nums[i] ≤3⋅104\leq 3 \cdot 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Sum Circular Subarray

med
30 min
Try to solve the Maximum Sum Circular Subarray problem.

Statement

Given an integer array nums representing a circular array, return the maximum possible sum of a non empty subarray of nums.

A subarray is a contiguous sequence of elements. Because nums is circular, a subarray may wrap from the end of the array back to the beginning, but each element of nums can be included at most once in the chosen subarray.

Constraints:

  • n == nums.length

  • 1≤1 \leq n ≤3⋅104\leq 3 \cdot 10^4

  • −3⋅104≤-3 \cdot 10^4 \leq nums[i] ≤3⋅104\leq 3 \cdot 10^4