Search
⌘K

Leetcode 2662. Minimum Cost of a Path With Special Roads

Find the minimum cost to go from start to target in a 2D grid where moving anywhere costs Manhattan distance but there are directed "special roads" (fixed-cost shortcuts between given points, reusable) that may reduce cost. Model start, target and all road endpoints as graph nodes with edges for Manhattan distances and directed special-road edges, then compute the shortest path (e.g., Dijkstra).

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late September, 2024

Google

Google

Mid-level

BFS problem: Find minimum cost path from source to destination with least roads taken, given equal cost roads

Comments

Your account is free and you can post anonymously if you choose.