Maximum Score with K-step Jumps
Updated
Problem statement
Start at index 0 of nums and reach index n - 1. From index i, you may jump to any index from i + 1 through min(n - 1, i + k), inclusive.
Your score is the sum of the values at all visited indices, including both the starting and ending indices. Return the greatest possible score. You must reach the ending index even if the best score is negative.
Function
maximumJumpScore(nums: int[], k: int) → intExamples
Example 1
nums = [1,-1,-2,4,-7,3]k = 2return = 7Visit indices 0, 1, 3, and 5 for score 1 - 1 + 4 + 3 = 7.
Example 2
nums = [-8]k = 1return = -8The start is already the destination and its value still counts.
Constraints
1 <= n == nums.length <= 20000.1 <= k <= n.-10000 <= nums[i] <= 10000.
More Rippling Phone Screen questions
- Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
- Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
- Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
- Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
- Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Median Across N Sorted ArraysPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Maximum Earnings Across WarehousesAmazon · ONSITE INTERVIEW
- Minimum Jump CostMicrosoft · OAMicrosoft interview questions
- Maximum Subarray Sum with One DeletionServiceNow · PHONE SCREENServiceNow interview questions
- Maximum Product of a Contiguous SubarrayLinkedIn · PHONE SCREENLinkedIn interview questions
- Design Hit CounterCharta Health · PHONE SCREENCharta Health interview questions
- Fewest Coins CombinationBloomberg LP · PHONE SCREENBloomberg LP interview questions
- Longest Increasing SubsequenceByteDance · PHONE SCREENByteDance interview questions
- Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
- Jump GamePaytm · PHONE SCREENPaytm interview questions
- Query Words Within K PositionsPalantir · PHONE SCREENPalantir interview questions