Practice Maximum Balanced Subsequence Sum
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#2926
LeetCode ProblemMaximum Balanced Subsequence Sum
Problem Statement
Choose a nonempty subsequence of nums. For each consecutive pair of selected indices i < j, require nums[j] - nums[i] >= j - i. A single selected entry is valid. Return the greatest sum of a subsequence satisfying this rule.
Source: Maximum Balanced Subsequence Sum on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [3,3,5,6]
Output
14
# Example 2
Input
nums = [5,-1,-3,8]
Output
13
# Example 3
Input
nums = [-2,-1]
Output
-1
Constraints
1 <= nums.length <= 10^5
-10^9 <= nums[i] <= 10^9
Related LeetCode Problems
Practice more problems similar to Maximum Balanced Subsequence Sum.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.