NeetCode #640LC-1334MediumAdvanced Graphs
← Back to All Problems#640 · #1334 · Find the City With the Smallest Number of Neighbors at a Threshold Distance(阈值距离内邻居最少的城市)
📌 Problem Statement & Constraints
There are
n cities with edges[i] = [from, to, weight]. Given distanceThreshold, return the city with the smallest number of reachable cities within the threshold (excluding itself); ties break by the largest index. Constraints: 2 <= n <= 100, 1 <= edges.length <= n * (n - 1) / 2.🔒
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!