FastPrepMinimize Path Value
Problems/Minimize Path Value

Minimize Path Value

Palantir logoPalantir● MediumINTERNOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Equivalent assessment sources confirm the complete graph-array contract. The judged core task matches the visible sources at about 99%.

You are given a weighted undirected graph with graph_nodes nodes numbered from 1 through graph_nodes. The arrays graph_from, graph_to, and graph_weight describe the graph's edges: edge i connects graph_from[i] and graph_to[i] with weight graph_weight[i].

The stress level of a path is the maximum edge weight on that path.

Return the minimum possible stress level among all paths from source to destination. If no such path exists, return -1. If source = destination, return 0.

Although the endpoint arrays are named graph_from and graph_to, every edge is undirected.

Function

minimizePathValue(graph_nodes: int, graph_from: int[], graph_to: int[], graph_weight: int[], source: int, destination: int) → int

Examples

Example 1

graph_nodes = 4graph_from = [2,2,1,4]graph_to = [1,3,4,3]graph_weight = [100,200,10,20]source = 1destination = 3return = 20

The graph is:

        (2)
      /     \
   100       200
    /         \
  (1)         (3)
    \         /
     10       20
      \       /
        (4)
  1. The path 1 -> 2 -> 3 has stress max(100, 200) = 200.
  2. The path 1 -> 4 -> 3 has stress max(10, 20) = 20.

The minimum possible stress is 20.

Constraints

  • 1 <= graph_nodes <= 10^5.
  • 1 <= graph_from.length = graph_to.length = graph_weight.length <= 10^5.
  • 1 <= graph_from[i], graph_to[i], source, destination <= graph_nodes.
  • 0 <= graph_weight[i] <= 10^9.

More Palantir Online Assessment questions

  • Basic Item DiscountsOA · Seen Nov 2026
  • Optimize Discount Selection Under a Point BudgetOA · Seen Nov 2026
  • Stacked Item and Category DiscountsOA · Seen Nov 2026
  • No Pairs AllowedOA · Seen Sep 2024
  • REST API: Country CodesOA · Seen Feb 2024
  • Swap ParityOA · Seen Feb 2024
  • Freelance Candidate ReviewOA · Seen Nov 2023
  • Benchmarking Tool ReportOA · Seen Sep 2023
  • Count Fit Records Across PagesOA · Seen Sep 2023
  • Network FormationOA · Seen Sep 2023

Similar questions at other companies

  • Minimum Stress PathWalmart · OAWalmart interview questions
  • Dijkstra Shortest Paths in a Weighted Undirected GraphVisa · OAVisa interview questions
  • Minimize Path ValueSalesforce · OASalesforce interview questions
  • Cookie Monster Minimum Arrival TimeIntuit · OAIntuit interview questions
  • Minimum Wizard Referral CostAirbnb · OAAirbnb interview questions
  • Minimum Travel Time with Flashing Traffic LightsPeopleStrong · OAPeopleStrong interview questions
  • Shortest Travel Time in a Grid with Traffic LightsWaymo · PHONE SCREENWaymo interview questions
  • Cheapest Flights Within K StopsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Shortest Paths in a Nonnegative Directed GraphNation with NaMo · PHONE SCREEN
  • Minimum Product Path in a Directed GraphGoogle · ONSITE INTERVIEWGoogle interview questions

Palantir interview experiences

  • Palantir SWE New Grad - Gotham
  • Palantir FDSE Experienced-Hire Interviews: 5 Experiences
  • Palantir FDSE New Grad OA Questions: 6 Experiences (Part 2 of 2)
  • Palantir FDSE New Grad Interviews: 5 Experiences (Part 1 of 2)
  • Palantir FDSE Intern OA and Interviews: 3 Experiences
  • Palantir FDSE Karat and Learning: 7 Experiences (Part 2 of 2)
All Palantir interview questionsSee Palantir hiring insights
Saved
class Solution {
    public int minimizePathValue(int graph_nodes, int[] graph_from, int[] graph_to, int[] graph_weight, int source, int destination) {
      // write your code here
    }
}
Checking account…