NeetCode #600LC-3243MediumGraphs
← Back to All Problems

#600 · #3243 · Shortest Distance After Road Addition Queries I(新增道路查询后的最短距离 I)

📌 Problem Statement & Constraints

There are n cities numbered 0..n-1 with a directed road from i to i+1 for each i. For each query [u, v], add a road u -> v and return the shortest path length from 0 to n-1. Constraints: 1 <= n <= 500, 1 <= queries.length <= 500, 0 <= u < v < n.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!