Skip to main content
All Questions

Compute each computer's score as the sum of task numbers it completes in order.

Unlock detailed company stats for this questionUpgrade

v[i] is the operational power of the i-th computer and b[j] is the minimum power required to complete the j-th task. A computer performs tasks starting from task 0 in order until it encounters a task whose required power exceeds its capacity. Its score is the sum of the (1-based) task numbers it successfully completes. Example: v = [5, 6, 3, 10], b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; a computer with power 5 completes tasks up to index 4, scoring 1+2+3+4+5 = 15.

Format · Part of Amazon's SDE-1 online assessment.

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.