Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Find the optimal starting layer that maximizes accumulated reward points.
Movement is strictly downward and bounded by a fixed initial energy budget.
Handle negative rewards and resolve ties by selecting the smallest starting index.
What This Tests
Prefix sum array construction and range query optimization
Constrained subarray tracking using sliding windows or deques
Handling negative values and precise tie-breaking logic
Achieving linear time complexity for large input arrays
Common Patterns
Prefix Sum
Sliding Window
Monotonic Stack
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected