0 day streak
Anonymous · shared experience1 Oct 2025 · 4 views

Cloudflare: Fewest partitions to hold all data

Interview question #Cloudflare SDE 2 Phone screen

Problem. You get a list of partition sizes and a list of how much data is in use. Data can be split into chunks across partitions. Return the minimum number of partitions needed to hold all of it.

Approach discussed. Add up the total data, sort partitions from largest to smallest and keep taking partitions until the total is covered. That is O(N log N) time with O(1) extra space.

What mattered. The candidate's first version used extra memory; the interviewer nudged them toward the greedy sort.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.