Reported May 2025
Agodagreedy

Two-Core Process Assignment

Reported by candidates from Agoda's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Agoda OA. Under 2s to a working solution.
Founder's read

Agoda's May 2025 OA included a problem about assigning processes to two cores. You've got a set of tasks and two processors. The trick is figuring out the optimal or balanced way to distribute them. This is a classic load-balancing problem that looks simple on the surface but has a sneaky optimization hiding underneath. If you blank on the live OA, StealthCoder will surface the pattern in seconds so you can code with confidence instead of panic.

Pattern and pitfall

Two-core assignment is fundamentally a partition problem. The goal is usually to either minimize the maximum load on any single core (load balancing) or achieve some specific constraint. The common approach is a greedy strategy or dynamic programming. Sort the tasks by duration descending, then assign each task to whichever core has less load right now. That greedy heuristic works well in practice. If the problem asks for an exact optimal split, you're looking at a subset sum variant, solvable with DP. The pitfall: candidates try to overthink the order or assume a specific assignment rule exists when they should test greedy first. StealthCoder becomes your safety net during the live session if you second-guess yourself on the approach.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Two-Core Process Assignment cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as minimize maximum pair sum in array. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Agoda's OA.

Agoda reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Two-Core Process Assignment FAQ

Is this about minimizing total time or balancing load across cores?+

Without the full problem text, both are common. If it says 'minimize makespan,' you want the shortest total time (max load on any core). If it's 'distribute fairly,' greedy by descending task size usually works. Read the exact constraint statement carefully in your OA.

Will sorting help?+

Almost always. Sorting tasks by duration in descending order before greedy assignment dramatically improves the heuristic. If the problem allows any assignment order, sort first. It's a free win.

Is this a dynamic programming problem?+

Not unless the OA explicitly asks for 'optimal' or 'exact' assignment. Greedy works for most real-world load balancing. DP is the hammer if greedy doesn't pass all test cases. Check the constraints and time limits in your actual OA.

What's the trick that trips people up?+

Assuming there's a clever closed-form solution when the answer is just 'apply greedy.' Candidates overthink, then run out of time. Code greedy first. It passes most test cases. Optimize only if it fails.

How do I code this in 15 minutes?+

Sort tasks descending. Use a min-heap or two variables to track load on each core. Assign each task to the core with lower current load. Update totals. Done. No fancy data structures needed unless constraints are huge.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Agoda.

OA at Agoda?
Invisible during screen share
Get it