Skip to main content
All Questions

Maximize net earnings across warehouses while skipping at most K consecutive ones.

Unlock detailed company stats for this questionUpgrade

A driver travels through warehouses arranged in a fixed order. Each warehouse has an associated value, which can be positive (earnings) or negative (tolls/costs). The driver must start at the first warehouse, must end at the last warehouse, and can skip at most K consecutive intermediate warehouses between visited stops. Maximize total net earnings. Example values discussed: [100, -30, -50, -50, -20, -30], with K = 3.

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.