<jupyter_start><jupyter_text>给定一个整数数组nums和一个整数k，返回该数组的非空子序列的最大和，    这样子序列中每两个连续整数nums[i]和nums[j]，其中i<j，满足条件j-i<=k。    数组的子序列是通过从数组中删除一定数量的元素（可以是零）来获得的，而剩下的元素则保持原来的顺序。        例1：        Input: nums = [10,2,-10,5,20], k = 2        Output: 37        Explanation: The subsequence is [10, 2, 5, 20].<jupyter_code>class Solution:
    def constrainedSubsetSum(self, nums, k: int) -> int:
        pass
nums_ = [10,2,-10,5,20]
k_ = 2
solution = Solution()
solution.constrainedSubsetSum(nums_, k_)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13926499032882012, 'fraction_numerical': 0.05222437137330754, 'mean_word_length': 4.56989247311828, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '594784', 'license': 'Apache-2.0', 'n_tokens_mistral': 289, 'n_tokens_neox': 285, 'n_words': 35, 'path': 'Dynamic Programming/past/1425. Constrained Subsequence Sum.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '517'}