As reported: Amazon SDE2 round 2 (Oct 2025): one DSA problem, plus Leadership Principle questions on end-to-end ownership and learning something new.
A country has n cities 0 … n − 1 connected by n − 1 bidirectional roads forming a tree; city 0 is the capital. Each other city has one representative who must travel to the capital. Each city has one car with seats seats. Driving a car along one road costs one litre of fuel. Representatives may switch cars or share a car at any city.
Return the minimum litres of fuel needed for all representatives to reach the capital.
This is LeetCode 2477 — Minimum Fuel Cost to Report to the Capital.
Example 1
roads = [[0,1],[0,2],[0,3]], seats = 5
Output: 3 each representative drives straight to 0
Example 2
roads = [[3,1],[3,2],[1,0],[0,4],[0,5],[4,6]], seats = 2
Output: 7
Example 3
roads = [], seats = 1
Output: 0
Constraints: 1 ≤ n ≤ 10^5; roads.length == n − 1; the roads form a tree; 1 ≤ seats ≤ 10^5.
Code runner format: two lines: roads as a JSON array of pairs, then seats. Implement minimumFuelCost(roads, seats); the harness prints the litres.