leetle

Daily challenge for 2026-03-28

452. Maximum Segment Sum With Jumps

You are given an array of integers nums and an integer k. You start at index 0 and must reach the last index n-1. In one move, you can jump from your current index i to any index j such that i < j <= i + k. Your score is the sum of the values of all indices you visit, including the starting index 0 and the ending index n-1. Return the maximum score you can achieve.

Example:
Input: nums = [10, -2, -3, 5, 20], k = 2
Output: 33
Explanation: The optimal path is 0 -> 1 -> 3 -> 4. Score: 10 + (-2) + 5 + 20 = 33.

Run this challenge interactively in Python or JavaScript when the app loads.