FastPrepTwo-Core Process Assignment
Problems/Two-Core Process Assignment

Two-Core Process Assignment

Agoda logoAgoda● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given an array time representing the time each process takes. Distribute processes across 2 cores such that the maximum total time on any core is minimized. Return the total time for both cores as an array: [sum_core1, sum_core2].

Every process goes to exactly one core, and a core may get no processes. The total time of a core is the sum of time[i] over the processes assigned to it. Core 1 is the core with the larger total, so sum_core1 is the smallest possible value of the larger total, and sum_core2 is the total of the other core (sum_core1 ≥ sum_core2).

Function

distributeProcesses(time: int[]) → int[]

Examples

Example 1

time = [10, 21, 10, 21, 10]return = [41, 31]

The total time is 72. A perfect split would be 36 and 36, but no group of processes adds up to 36. The best you can do is 41 and 31, for example {21, 10, 10} on core 1 and {21, 10} on core 2. The larger total, 41, comes first.

Constraints

  • 1 ≤ time.length ≤ 100
  • 1 ≤ time[i] ≤ 1000

More Agoda interview questions

  • Sort Ones, Twos, and Threes In PlacePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Can Place FlowersPHONE SCREEN · Seen Nov 2026
  • Reverse Words in a StringPHONE SCREEN · Seen Nov 2026
  • Molecular Weight of a Grouped FormulaONSITE INTERVIEW · Seen Oct 2026
  • Disk Space Window AnalyzerPHONE SCREEN · Seen Sep 2026
  • Shortest Subarray With the Full DegreePHONE SCREEN · Seen Sep 2026
  • Enumerate Weekly Work SchedulesPHONE SCREEN · Seen Sep 2026
  • Count Values Appearing Exactly OncePHONE SCREEN · Seen Sep 2026
  • Longest All-Present Attendance StreakPHONE SCREEN · Seen Sep 2026
  • Chemical Formula WeightPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Maximum Score with Prime JumpsMicrosoft · OAMicrosoft interview questions
  • Maximum Beauty by DeletionsMeesho · OA
  • Card Game: Best First-Player ScoreShopify · OAShopify interview questions
  • Maximum Game Score with Fixed Forward JumpsStripe · OAStripe interview questions
  • 0/1 KnapsackConfluent · OAConfluent interview questions
  • Minimum Cost to Tile a Strip with Widths 1, 2, and 3Infosys · OAInfosys interview questions
  • Maximum Subarray SumStraive · OA
  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Lowest-Cost Shirt Color ScheduleElevenLabs · OAElevenLabs interview questions
  • Maximum Game Board ScoreJP Morgan Chase · OAJP Morgan Chase interview questions

Agoda interview experiences

  • Agoda Staff Backend OA Questions: 5 Experiences
All Agoda interview questionsSee Agoda hiring insights
Saved
class Solution {
    public int[] distributeProcesses(int[] time) {
      // write your code here
    }

}
Checking account…