Reported September 2024
Salesforceheap priority queue

Get Min Time

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

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

You've got a Salesforce OA in your inbox and the problem is 'Get Min Time'. This is a classic optimization problem where you're finding the minimum time to complete some sequence of tasks or operations. The catch is usually in recognizing that you can't just greedily pick the fastest option. You need to see the trade-off between parallelization, dependencies, or batching. StealthCoder will have your back if you freeze on the state transitions, but knowing the pattern now means you won't need it.

Pattern and pitfall

This problem almost always involves either simulation with priority queues, dynamic programming over states, or a greedy reordering insight. The most common variant: you have workers or machines, multiple tasks with different durations, and you need to assign them optimally to minimize total time. The trap is treating it as a simple sort. You'll likely need a min-heap to always process the worker or task with the earliest available time, then update it. If there are dependencies or batch constraints, you're looking at DP or graph traversal. Walk through the examples carefully to spot whether time compounds additively, runs in parallel, or resets. StealthCoder can surface the pattern in seconds if you're stuck mid-problem, but the real edge is locking in the simulation loop before you code.

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 Get Min Time 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 minimum time to complete all tasks. If you have time before the OA, drill that.

⏵ The honest play

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

Salesforce 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.

Get Min Time FAQ

Is this a heap problem?+

Usually yes. If you're assigning tasks to workers or machines, you'll track which one finishes earliest and assign the next task to it. Min-heap handles that in O(log n) per assignment. But check the examples first: if all tasks must happen in sequence, it might just be math or dynamic programming instead.

What's the most common pitfall?+

Sorting tasks by duration and greedily assigning doesn't work. You have to simulate the actual process, updating the state of each worker or machine after each assignment. Read the problem statement twice to catch whether tasks are independent, sequential, or have weird constraints.

Can I brute force this in 2 hours?+

Not if n is large. If n is under 20 and the problem hints at permutations or subsets, brute force all orderings with memoization might pass. But Salesforce usually sizes problems to demand the optimal greedy or DP pattern. Identify that first.

How do I test my solution fast?+

Write a simple simulation for the examples by hand. Track the state (worker finish times, task queue) at each step. If your code's output doesn't match, the issue is usually in how you're updating state or breaking ties. Edge case: what if two workers finish at the same time? The problem might care about tiebreaker order.

Is this still asked in 2024?+

Yes. Salesforce used it in September 2024. Optimization problems with time-based state are evergreen in OAs. The names and task types vary (delivery, machine scheduling, network routing), but the underlying pattern is stable.

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

OA at Salesforce?
Invisible during screen share
Get it