Reported July 2024
Salesforcegraph

Least Stressful Path

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

Salesforce asked this in July 2024, and it's a graph traversal problem disguised as a path-optimization question. You're hunting for a route through a weighted graph where the goal isn't shortest distance but lowest stress, usually measured by maximum edge weight on the path. The OA doesn't tell you the graph structure upfront, so you'll need to parse it fast. StealthCoder reads the problem statement and feeds you the approach before you lock in a solution.

Pattern and pitfall

This is a min-max path problem, not a shortest-path one. Dijkstra won't work directly because you're minimizing the worst edge, not the sum. The pattern: binary search on the answer (what's the minimum stress level needed?) combined with graph traversal, or use a priority queue ordered by maximum stress seen so far instead of cumulative distance. Common trap: coding Dijkstra reflexively and then realizing your edge weights matter differently. The trick is recognizing that you're bottleneck-optimizing, not summing costs. StealthCoder as a safety net means if you freeze on whether to use Dijkstra or BFS with a different comparator, you get the real approach in real time without breaking flow.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Least Stressful Path 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as path with maximum minimum value. 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Least Stressful Path FAQ

Is this really asking for the path with the smallest maximum edge?+

Yes. 'Least stressful' means you want to minimize the worst stress point on any single edge. It's not about total stress. That's why naive shortest-path fails. You're looking for the path where the heaviest edge is as light as possible.

Can I solve this with Dijkstra?+

Not the standard version. You can modify it: instead of tracking cumulative distance, track the maximum edge weight seen so far. Use a min-heap ordered by that maximum, not the sum. It's Dijkstra-adjacent but a different comparator.

What if the graph is dense or has cycles?+

Cycles don't break you because you're exploring paths, not finding the absolute minimum globally. A modified Dijkstra or BFS with proper visited tracking handles it. The key is the priority queue ordering, not the graph shape.

How do I parse the input quickly on the OA?+

Look for adjacency list or matrix format. Build a graph structure (dict of lists or 2D array). Identify source and destination. Then pick your algorithm. Don't overthink the parsing. The tricky part is the algorithm, not the setup.

Is this still asked after mid-2024?+

Graph traversal with a twist stays common at Salesforce. The specific flavor changes, but min-max or bottleneck path problems appear regularly. Knowing this pattern is a hedge worth having.

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