Skip to main content
Back to problems
Leetcode
Easy
Arrays
Maximum Ascending Subarray Sum

Find the largest sum of any contiguous strictly increasing segment in an array.

Acceptance 0%
Problem Statement

Problem

Given an integer array nums, consider every contiguous subarray whose values are strictly increasing from left to right.

Return the maximum possible sum of such a subarray.

A subarray must consist of consecutive elements, and for every adjacent pair in that subarray, the later element must be greater than the earlier one.

Input Format

  • A single integer array nums.
  • nums contains one or more integers.

Output Format

  • Return one integer: the maximum sum of any contiguous strictly increasing subarray.

Constraints

  • The array length is at least 1.
  • A valid subarray must be contiguous.
  • Consecutive values in the chosen subarray must satisfy nums[i] < nums[i + 1].
  • Use 32-bit integer-safe reasoning where applicable.
Examples
Sample cases returned by the problem API.

Example 1

Input

nums = [10,20,30,5,10,50]

Output

65

Explanation

The strictly increasing subarray [5,10,50] has sum 65, which is the largest among all ascending subarrays.

Example 2

Input

nums = [12,17,15,13,10,11,12]

Output

33

Explanation

The best ascending subarray is [10,11,12], with sum 33.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.