Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3282. Reach End of Array With Max Score
Given an array nums, start at index 0 and jump only forward to reach n-1, where a jump i→j yields score (j−i)*nums[i]; maximize the total score. This reduces to a DP dp[j] = max_i(dp[i] - i*nums[i] + j*nums[i]) and can be optimized from O(n^2) to O(n log n) (or O(n)) using a max line container / convex-hull-trick or Li Chao tree for n up to 1e5.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.