Skip to main content
All Questions

Find the minimum number of storage partitions needed to hold all data.

Unlock detailed company stats for this questionUpgrade

The storage drive is not used efficiently because the data is scattered across many partitions, each with some space already used under its maximum capacity. Rearrange the data so that it takes up the fewest possible partitions, and return the minimum number of partitions needed. Example: n = 5 partitions, used = 3, 2, 1, 3, 1, total capacity = 3, 5, 3, 5, 5. Output = 2.

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.