Leetcode 2106. Maximum Fruits Harvested After at Most K Steps
Given sorted fruit positions with amounts, find the maximum total fruits collectible starting at startPos with at most k steps, where you may walk left or right and can turn at most once; the core challenge is selecting the best contiguous interval of positions reachable within k (accounting for turn costs). This is typically solved by scanning intervals and using prefix sums with two-pointer/sliding-window logic to test reachability efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.