Salesforce Onsite round

salesforce logo
salesforce
June 21, 2026 · 1 reads

Summary

I was asked a partitioning problem during my Salesforce onsite interview.

Full Experience

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

Interview Questions (1)

1.

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 = 3

Find the optimal partitioning and the resulting minimized sum of weekly maxima.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!