Salesforce Onsite round
- Posted
- 21 Jun 2026
Summary
I was asked a partitioning problem during my Salesforce onsite interview.
How it went
Hi guys, I recently got this question in my Salesforce onsite round.
Given an array of campaign costs and number of weeks, partition the
campaigns optimally to minimize the sum of weekly maxima.
Sample test cases:
costs = [2, 5, 4, 3, 7, 1, 6, 8]
weeks = 3
Questions asked (1)
- 01
Partition Campaign Costs to Minimize Weekly Maxima
Data Structures & Algorithms
Given an array of campaign costs and a number of weeks, partition the campaigns into the given number of weeks such that the sum of the maximum cost in each week is minimized.
Example:
costs = [2, 5, 4, 3, 7, 1, 6, 8] weeks = 3Find the optimal partitioning and the resulting minimized sum of weekly maxima.