Salesforce Onsite round

Posted
21 Jun 2026
78 reads

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)

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

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

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Salesforce recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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