NeetCode #554LC-1425HardHeap / Priority Queue
← Back to All Problems#554 · #1425 · Constrained Subsequence Sum(带限制的子序列和)
📌 Problem Statement & Constraints
Given an integer array
nums and an integer k, return the maximum sum of a non-empty subsequence such that for every two consecutive chosen indices i < j, j - i <= k. Constraints: 1 <= k <= nums.length <= 10^5, -10^4 <= nums[i] <= 10^4.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!