Search
⌘K
Get Premium
Leetcode 2247. Maximum Cost of Trip With K Highways
Given a weighted graph where some edges are designated as highways, find the maximum-cost trip between two nodes while using at most K highways (or exactly K, per statement), which requires treating the number of highways used as an extra state and solving a constrained longest-path problem via DP/state-expanded graph techniques (e.g., modified Dijkstra/Bellman-Ford over node×k states) to manage cycles and the K constraint.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Mid January, 2025
Meta
Mid-level
Plan a round trip between 2 cities with minimum flight cost, given departure and return cost arrays
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.